Fix coverage handling for non_local tests.
This commit is contained in:
parent
f47191674e
commit
156613f025
2 changed files with 11 additions and 5 deletions
|
@ -1183,7 +1183,8 @@ def command_integration_script(args, target, test_dir, inventory_path):
|
|||
if config_path:
|
||||
cmd += ['-e', '@%s' % config_path]
|
||||
|
||||
intercept_command(args, cmd, target_name=target.name, env=env, cwd=cwd)
|
||||
coverage = args.coverage and 'non_local/' not in target.aliases
|
||||
intercept_command(args, cmd, target_name=target.name, env=env, cwd=cwd, coverage=coverage)
|
||||
|
||||
|
||||
def command_integration_role(args, target, start_at_task, test_dir, inventory_path):
|
||||
|
@ -1265,7 +1266,8 @@ def command_integration_role(args, target, start_at_task, test_dir, inventory_pa
|
|||
|
||||
env['ANSIBLE_ROLES_PATH'] = os.path.abspath(os.path.join(test_env.integration_dir, 'targets'))
|
||||
|
||||
intercept_command(args, cmd, target_name=target.name, env=env, cwd=cwd)
|
||||
coverage = args.coverage and 'non_local/' not in target.aliases
|
||||
intercept_command(args, cmd, target_name=target.name, env=env, cwd=cwd, coverage=coverage)
|
||||
|
||||
|
||||
def command_units(args):
|
||||
|
|
|
@ -183,7 +183,7 @@ def generate_pip_command(python):
|
|||
return [python, '-m', 'pip.__main__']
|
||||
|
||||
|
||||
def intercept_command(args, cmd, target_name, capture=False, env=None, data=None, cwd=None, python_version=None, path=None):
|
||||
def intercept_command(args, cmd, target_name, capture=False, env=None, data=None, cwd=None, python_version=None, path=None, coverage=None):
|
||||
"""
|
||||
:type args: TestConfig
|
||||
:type cmd: collections.Iterable[str]
|
||||
|
@ -194,11 +194,15 @@ def intercept_command(args, cmd, target_name, capture=False, env=None, data=None
|
|||
:type cwd: str | None
|
||||
:type python_version: str | None
|
||||
:type path: str | None
|
||||
:type coverage: bool | None
|
||||
:rtype: str | None, str | None
|
||||
"""
|
||||
if not env:
|
||||
env = common_environment()
|
||||
|
||||
if coverage is None:
|
||||
coverage = args.coverage
|
||||
|
||||
cmd = list(cmd)
|
||||
version = python_version or args.python_version
|
||||
interpreter = find_python(version, path)
|
||||
|
@ -211,13 +215,13 @@ def intercept_command(args, cmd, target_name, capture=False, env=None, data=None
|
|||
env['ANSIBLE_TEST_PYTHON_VERSION'] = version
|
||||
env['ANSIBLE_TEST_PYTHON_INTERPRETER'] = interpreter
|
||||
|
||||
if args.coverage:
|
||||
if coverage:
|
||||
env['_ANSIBLE_COVERAGE_CONFIG'] = os.path.join(inject_path, '.coveragerc')
|
||||
env['_ANSIBLE_COVERAGE_OUTPUT'] = coverage_file
|
||||
|
||||
config = dict(
|
||||
python_interpreter=interpreter,
|
||||
coverage_file=coverage_file if args.coverage else None,
|
||||
coverage_file=coverage_file if coverage else None,
|
||||
)
|
||||
|
||||
if not args.explain:
|
||||
|
|
Loading…
Reference in a new issue