mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Refactor ansible-test config classes. (#26505)
* Move Config classes from executor.py to config.py. * Move Environment and Test config to config.py. * Move Coverage/CoverageReport Config to config.py. * Clean up type hints.
This commit is contained in:
parent
bd8ea89b1b
commit
45e377566c
10 changed files with 270 additions and 231 deletions
|
@ -7,11 +7,10 @@ import json
|
|||
|
||||
from lib.util import (
|
||||
display,
|
||||
EnvironmentConfig,
|
||||
)
|
||||
|
||||
from lib.metadata import (
|
||||
Metadata,
|
||||
from lib.config import (
|
||||
TestConfig,
|
||||
)
|
||||
|
||||
|
||||
|
@ -55,38 +54,6 @@ def calculate_confidence(path, line, metadata):
|
|||
return 50
|
||||
|
||||
|
||||
class TestConfig(EnvironmentConfig):
|
||||
"""Configuration common to all test commands."""
|
||||
def __init__(self, args, command):
|
||||
"""
|
||||
:type args: any
|
||||
:type command: str
|
||||
"""
|
||||
super(TestConfig, self).__init__(args, command)
|
||||
|
||||
self.coverage = args.coverage # type: bool
|
||||
self.coverage_label = args.coverage_label # type: str
|
||||
self.include = args.include # type: list [str]
|
||||
self.exclude = args.exclude # type: list [str]
|
||||
self.require = args.require # type: list [str]
|
||||
|
||||
self.changed = args.changed # type: bool
|
||||
self.tracked = args.tracked # type: bool
|
||||
self.untracked = args.untracked # type: bool
|
||||
self.committed = args.committed # type: bool
|
||||
self.staged = args.staged # type: bool
|
||||
self.unstaged = args.unstaged # type: bool
|
||||
self.changed_from = args.changed_from # type: str
|
||||
self.changed_path = args.changed_path # type: list [str]
|
||||
|
||||
self.lint = args.lint if 'lint' in args else False # type: bool
|
||||
self.junit = args.junit if 'junit' in args else False # type: bool
|
||||
self.failure_ok = args.failure_ok if 'failure_ok' in args else False # type: bool
|
||||
|
||||
self.metadata = Metadata.from_file(args.metadata) if args.metadata else Metadata()
|
||||
self.metadata_path = None
|
||||
|
||||
|
||||
class TestResult(object):
|
||||
"""Base class for test results."""
|
||||
def __init__(self, command, test, python_version=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue