summaryrefslogtreecommitdiff
path: root/igor.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-11-10 08:48:37 -0500
committerNed Batchelder <ned@nedbatchelder.com>2018-11-11 16:45:33 -0500
commit66e64c837fe04ff12d86ec3f196a3ca888bc9c78 (patch)
treef3a4869d3cf3f805cebe6f9e954370a4c3bc9313 /igor.py
parente5dcb933ab791206040a849eacd726ffe40c348a (diff)
downloadpython-coveragepy-git-66e64c837fe04ff12d86ec3f196a3ca888bc9c78.tar.gz
Keep test tempdirs distinct, for saving and comparing test output
Diffstat (limited to 'igor.py')
-rw-r--r--igor.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/igor.py b/igor.py
index 78de37a2..a1746351 100644
--- a/igor.py
+++ b/igor.py
@@ -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