mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-10 11:11:29 -07:00
Convert sanity tests to plugins. (#28425)
* Move sanity into directory. * Omit abstract classes from returned subclass list. * Split sanity tests out into plugins. * Fix abstract class handling for Python 3.
This commit is contained in:
parent
7fc4e6b4af
commit
688823014f
15 changed files with 1164 additions and 912 deletions
44
test/runner/lib/sanity/sanity_docs.py
Normal file
44
test/runner/lib/sanity/sanity_docs.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
"""Sanity test for documentation of sanity tests."""
|
||||
from __future__ import absolute_import, print_function
|
||||
|
||||
import os
|
||||
|
||||
from lib.sanity import (
|
||||
SanitySingleVersion,
|
||||
SanityMessage,
|
||||
SanityFailure,
|
||||
SanitySuccess,
|
||||
sanity_get_tests,
|
||||
)
|
||||
|
||||
from lib.config import (
|
||||
SanityConfig,
|
||||
)
|
||||
|
||||
|
||||
class SanityDocsTest(SanitySingleVersion):
|
||||
"""Sanity test for documentation of sanity tests."""
|
||||
# noinspection PyUnusedLocal
|
||||
def test(self, args, targets): # pylint: disable=locally-disabled, unused-argument
|
||||
"""
|
||||
:type args: SanityConfig
|
||||
:type targets: SanityTargets
|
||||
:rtype: SanityResult
|
||||
"""
|
||||
sanity_dir = 'docs/docsite/rst/dev_guide/testing/sanity'
|
||||
sanity_docs = set(part[0] for part in (os.path.splitext(name) for name in os.listdir(sanity_dir)) if part[1] == '.rst')
|
||||
sanity_tests = set(sanity_test.name for sanity_test in sanity_get_tests())
|
||||
|
||||
missing = sanity_tests - sanity_docs
|
||||
|
||||
results = []
|
||||
|
||||
results += [SanityMessage(
|
||||
message='missing docs for ansible-test sanity --test %s' % r,
|
||||
path=os.path.join(sanity_dir, '%s.rst' % r),
|
||||
) for r in sorted(missing)]
|
||||
|
||||
if results:
|
||||
return SanityFailure(self.name, messages=results)
|
||||
|
||||
return SanitySuccess(self.name)
|
Loading…
Add table
Add a link
Reference in a new issue