From a7acd74eabe3a0764c50bba7eb1f1dd5acef46c7 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 25 Aug 2015 14:57:39 -0400 Subject: Better metacov file naming and combining Now .metacov data files are named for the platform they are running on, and are combined at the end of the test suite, so each platform only has a dozen files to copy, instead of hundreds. --- coverage/data.py | 2 +- igor.py | 13 ++++++++----- metacov.ini | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/coverage/data.py b/coverage/data.py index c19b5c64..41883398 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -102,7 +102,7 @@ class CoverageData(object): # * runs: a list of dicts of information about the coverage.py runs # contributing to the data:: # - # [ { "briefsys": "CPython 2.7.10 Darwin" }, ... ] + # [ { "brief_sys": "CPython 2.7.10 Darwin" }, ... ] # # Only one of `lines` or `arcs` will be present: with branch coverage, data # is stored as arcs. Without branch coverage, it is stored as lines. The diff --git a/igor.py b/igor.py index 0cb7c705..54d39d79 100644 --- a/igor.py +++ b/igor.py @@ -15,7 +15,6 @@ import glob import inspect import os import platform -import socket import sys import textwrap import warnings @@ -120,10 +119,14 @@ def run_tests_with_coverage(tracer, *nose_args): # 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] - suffix = "%s%s_%s_%s" % (impl, version, tracer, socket.gethostname()) + 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()) + + os.environ['COVERAGE_METAFILE'] = os.path.abspath(".metacov."+suffix) import coverage - cov = coverage.Coverage(config_file="metacov.ini", data_suffix=suffix) + cov = coverage.Coverage(config_file="metacov.ini", data_suffix=False) # Cheap trick: the coverage.py code itself is excluded from measurement, # but if we clobber the cover_prefix in the coverage object, we can defeat # the self-detection. @@ -157,6 +160,7 @@ def run_tests_with_coverage(tracer, *nose_args): cov.stop() os.remove(pth_path) + #cov.combine() cov.save() @@ -310,8 +314,7 @@ def print_banner(label): version = platform.python_version() if '__pypy__' in sys.builtin_module_names: - pypy_version = sys.pypy_version_info - version += " (pypy %s)" % ".".join(str(v) for v in pypy_version) + version += " (pypy %s)" % ".".join(str(v) for v in sys.pypy_version_info) which_python = os.path.relpath(sys.executable) print('=== %s %s %s (%s) ===' % (impl, version, label, which_python)) diff --git a/metacov.ini b/metacov.ini index ba8c234a..fd7c7d04 100644 --- a/metacov.ini +++ b/metacov.ini @@ -4,7 +4,7 @@ # Settings to use when using coverage.py to measure itself. [run] branch = true -data_file = $COVERAGE_HOME/.metacov +data_file = $COVERAGE_METAFILE parallel = true source = $COVERAGE_HOME/coverage -- cgit v1.2.1