summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-07-29 11:12:49 -0400
committerNed Batchelder <ned@nedbatchelder.com>2016-07-29 11:12:49 -0400
commit82f1033878b5e2a16580a159e1dd4480c0145e3b (patch)
treee452e0a9c17c3a524ef2dafa1a9b373e3741d21b
parent346658e7b38a1ce8ea86308879de3a0288a4d899 (diff)
downloadpython-coveragepy-git-82f1033878b5e2a16580a159e1dd4480c0145e3b.tar.gz
Add a test that .pth measurement doesn't include existing data
-rw-r--r--CHANGES.rst5
-rw-r--r--tests/test_process.py7
2 files changed, 12 insertions, 0 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index bacf3339..14300c8f 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -8,6 +8,11 @@ Change history for Coverage.py
Unreleased
----------
+- Subprocesses that are measured with `automatic subprocess measurement`_ used
+ to read in any pre-existing data file. This meant data would be incorrectly
+ carried forward from run to run. Now those files are not read, so each
+ subprocess only writes its own data.
+
- Corrected the name of the jquery.ba-throttle-debounce.js library. Thanks,
Ben Finney. Closes `issue 505`_.
diff --git a/tests/test_process.py b/tests/test_process.py
index 5848b9ff..53d2362a 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -1088,6 +1088,13 @@ class ProcessStartupTest(ProcessCoverageMixin, CoverageTest):
if env.METACOV:
self.skipTest("Can't test sub-process pth file suppport during metacoverage")
+ # An existing data file should not be read when a subprocess gets
+ # measured automatically. Create the data file here with bogus data in
+ # it.
+ data = coverage.CoverageData()
+ data.add_lines({os.path.abspath('sub.py'): dict.fromkeys(range(100))})
+ data.write_file(".mycovdata")
+
self.make_file("coverage.ini", """\
[run]
data_file = .mycovdata