tmt.checks package
Submodules
tmt.checks.avc module
- class tmt.checks.avc.AvcDenials(*args: Any, **kwargs: Any)
Bases:
CheckPlugin[Check]Check for SELinux AVC denials raised during the test.
The check collects SELinux AVC denials from the audit log, gathers details about them, and together with versions of the
selinux-policyand related packages stores them in a file after the test.check: - name: avc
New in version 1.28.
- classmethod after_test(*, check: Check, invocation: TestInvocation, environment: dict[str, str] | None = None, logger: Logger) list[tmt.result.CheckResult]
tmt.checks.dmesg module
- class tmt.checks.dmesg.DmesgCheck(*args: Any, **kwargs: Any)
Bases:
CheckPlugin[Check]Save the content of kernel ring buffer (aka “console”) into a file.
The check saves one file before the test, and then again when test finishes.
check: - name: dmesg
New in version 1.28.
- classmethod after_test(*, check: Check, invocation: TestInvocation, environment: dict[str, str] | None = None, logger: Logger) list[tmt.result.CheckResult]
- classmethod before_test(*, check: Check, invocation: TestInvocation, environment: dict[str, str] | None = None, logger: Logger) list[tmt.result.CheckResult]
Module contents
- class tmt.checks.Check(how: str, enabled: bool = True)
Bases:
SpecBasedContainer[_RawCheck,_RawCheck],SerializableContainer,NormalizeKeysMixinRepresents a single check from test’s
checkfield.Serves as a link between raw fmf/CLI specification and an actual check implementation/plugin.
- enabled: bool = True
- classmethod from_spec(raw_data: _RawCheck, logger: Logger) Check
Convert from a specification file or from a CLI option
See https://tmt.readthedocs.io/en/stable/classes.html#class-conversions for more details.
See
to_spec()for its counterpart.
- go(*, event: CheckEvent, invocation: TestInvocation, environment: dict[str, str] | None = None, logger: Logger) list['CheckResult']
Run the check.
- Parameters:
event – when the check is running - before the test, after the test, etc.
invocation – test invocation to which the check belongs to.
environment – optional environment to set for the check.
logger – logger to use for logging.
- Returns:
list of results produced by checks.
- how: str
- plugin
- to_spec() _RawCheck
Convert to a form suitable for saving in a specification file
See https://tmt.readthedocs.io/en/stable/classes.html#class-conversions for more details.
See
from_spec()for its counterpart.
- class tmt.checks.CheckEvent(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
EnumEvents in test runtime when a check can be executed
- AFTER_TEST = 'after-test'
- BEFORE_TEST = 'before-test'
- classmethod from_spec(spec: str) CheckEvent
- class tmt.checks.CheckPlugin(*args: Any, **kwargs: Any)
Bases:
_CommonBase,Generic[CheckT]Base class for plugins providing extra checks before, during and after tests
- classmethod after_test(*, check: CheckT, invocation: TestInvocation, environment: dict[str, str] | None = None, logger: Logger) list['CheckResult']
- classmethod before_test(*, check: CheckT, invocation: TestInvocation, environment: dict[str, str] | None = None, logger: Logger) list['CheckResult']
- class tmt.checks.CheckT
A type variable representing a
Checkinstances.alias of TypeVar(‘CheckT’, bound=
Check)
- tmt.checks.find_plugin(name: str) type[tmt.checks.CheckPlugin[Any]]
Find a plugin by its name.
- Raises:
GeneralError – when the plugin does not exist.
- tmt.checks.normalize_test_check(key_address: str, raw_test_check: Any, logger: Logger) Check
Normalize a single test check
- tmt.checks.normalize_test_checks(key_address: str, raw_checks: Any, logger: Logger) list[tmt.checks.Check]
Normalize (prepare/finish/test) checks
- tmt.checks.provides_check(check: str) Callable[[type[tmt.checks.CheckPlugin[Any]]], type[tmt.checks.CheckPlugin[Any]]]
A decorator for registering test checks.
Decorate a test check plugin class to register its checks.