diff --git a/test/runner/lib/executor.py b/test/runner/lib/executor.py index f8c29c6d35..7045d478c9 100644 --- a/test/runner/lib/executor.py +++ b/test/runner/lib/executor.py @@ -346,7 +346,7 @@ def command_network_integration(args): instances = [] # type: list [lib.thread.WrappedThread] if args.platform: - get_coverage_path(args, args.python_version, args.python_executable) # initialize before starting threads + get_coverage_path(args, args.python_executable) # initialize before starting threads configs = dict((config['platform_version'], config) for config in args.metadata.instance_config) @@ -514,7 +514,7 @@ def command_windows_integration(args): httptester_id = None if args.windows: - get_coverage_path(args, args.python_version, args.python_executable) # initialize before starting threads + get_coverage_path(args, args.python_executable) # initialize before starting threads configs = dict((config['platform_version'], config) for config in args.metadata.instance_config) diff --git a/test/runner/lib/util.py b/test/runner/lib/util.py index 14f3543b8e..17d78f5b77 100644 --- a/test/runner/lib/util.py +++ b/test/runner/lib/util.py @@ -197,7 +197,7 @@ def intercept_command(args, cmd, target_name, capture=False, env=None, data=None cmd = list(cmd) version = python_version or args.python_version interpreter = find_python(version, path) - inject_path = get_coverage_path(args, version, interpreter) + inject_path = get_coverage_path(args, interpreter) config_path = os.path.join(inject_path, 'injector.json') coverage_file = os.path.abspath(os.path.join(inject_path, '..', 'output', '%s=%s=%s=%s=coverage' % ( args.command, target_name, args.coverage_label or 'local-%s' % version, 'python-%s' % version))) @@ -222,19 +222,18 @@ def intercept_command(args, cmd, target_name, capture=False, env=None, data=None return run_command(args, cmd, capture=capture, env=env, data=data, cwd=cwd) -def get_coverage_path(args, version, interpreter): +def get_coverage_path(args, interpreter): """ :type args: TestConfig - :type version: str :type interpreter: str :rtype: str """ - coverage_path = COVERAGE_PATHS.get(version) + coverage_path = COVERAGE_PATHS.get(interpreter) if coverage_path: return os.path.join(coverage_path, 'coverage') - prefix = 'ansible-test-coverage-python-%s-' % version + prefix = 'ansible-test-coverage-' tmp_dir = '/tmp' if args.explain: @@ -261,15 +260,15 @@ def get_coverage_path(args, version, interpreter): if not COVERAGE_PATHS: atexit.register(cleanup_coverage_dirs) - COVERAGE_PATHS[version] = coverage_path + COVERAGE_PATHS[interpreter] = coverage_path return os.path.join(coverage_path, 'coverage') def cleanup_coverage_dirs(): """Clean up all coverage directories.""" - for version, path in COVERAGE_PATHS.items(): - display.info('Cleaning up coverage directory for Python %s: %s' % (version, path), verbosity=2) + for path in COVERAGE_PATHS.values(): + display.info('Cleaning up coverage directory: %s' % path, verbosity=2) cleanup_coverage_dir(path)