diff options
-rw-r--r-- | igor.py | 19 | ||||
-rw-r--r-- | tests/coveragetest.py | 2 |
2 files changed, 13 insertions, 8 deletions
@@ -90,10 +90,21 @@ def should_skip(tracer): return msg +def make_env_id(tracer): + """An environment id that will keep all the test runs distinct.""" + impl = platform.python_implementation().lower() + version = "%s%s" % sys.version_info[:2] + if '__pypy__' in sys.builtin_module_names: + version += "_%s%s" % sys.pypy_version_info[:2] + env_id = "%s%s_%s" % (impl, version, tracer) + return env_id + + def run_tests(tracer, *runner_args): """The actual running of tests.""" if 'COVERAGE_TESTING' not in os.environ: os.environ['COVERAGE_TESTING'] = "True" + os.environ['COVERAGE_ENV_ID'] = make_env_id(tracer) print_banner(label_for_tracer(tracer)) return pytest.main(list(runner_args)) @@ -114,13 +125,7 @@ def run_tests_with_coverage(tracer, *runner_args): with open(pth_path, "w") as pth_file: pth_file.write("import coverage; coverage.process_startup()\n") - # Make names for the data files that keep all the test runs distinct. - impl = platform.python_implementation().lower() - version = "%s%s" % sys.version_info[:2] - if '__pypy__' in sys.builtin_module_names: - version += "_%s%s" % sys.pypy_version_info[:2] - suffix = "%s%s_%s_%s" % (impl, version, tracer, platform.platform()) - + suffix = "%s_%s" % (make_env_id(tracer), platform.platform()) os.environ['COVERAGE_METAFILE'] = os.path.abspath(".metacov."+suffix) import coverage diff --git a/tests/coveragetest.py b/tests/coveragetest.py index d08c334e..8b893e56 100644 --- a/tests/coveragetest.py +++ b/tests/coveragetest.py @@ -81,7 +81,7 @@ class CoverageTest( show_stderr = True # Temp dirs go to $TMPDIR/coverage_test/* - temp_dir_prefix = "coverage_test/" + temp_dir_prefix = "coverage_test/{}/".format(os.getenv('COVERAGE_ENV_ID', 'x')) # Keep the temp directories if the env says to. # $set_env.py: COVERAGE_KEEP_TMP - Keep the temp directories made by tests. |