diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-03-11 14:15:17 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-03-11 14:15:17 -0500 |
commit | 7c047ac7b2a1ed797bd959d268fe7d25044ca9b3 (patch) | |
tree | 4f4c9c87d737e2467b7e1b0a1c8ab2df099eca4d | |
parent | 1993287b762daf89afd4a9c626f6a49e95db3b1f (diff) | |
download | python-coveragepy-git-7c047ac7b2a1ed797bd959d268fe7d25044ca9b3.tar.gz |
Cleanly stop coverage objects, for metacov
Without these cov.stop() calls, the collector stack is wrong when doing
meta-coverage.
-rw-r--r-- | coverage/collector.py | 2 | ||||
-rw-r--r-- | tests/test_api.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/coverage/collector.py b/coverage/collector.py index 1c8c83b5..cfdcf402 100644 --- a/coverage/collector.py +++ b/coverage/collector.py @@ -307,7 +307,7 @@ class Collector(object): except TypeError: raise Exception("fullcoverage must be run with the C trace function.") - # Install our installation tracer in threading, to jump start other + # Install our installation tracer in threading, to jump-start other # threads. if self.threading: self.threading.settrace(self._installation_trace) diff --git a/tests/test_api.py b/tests/test_api.py index 07f5506a..33108248 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -299,6 +299,8 @@ class ApiTest(CoverageTest): cov.save() import_local_file("code2") self.check_code1_code2(cov) + # Then stop it, or the test suite gets out of whack. + cov.stop() def test_two_getdata_only_warn_once(self): self.make_code1_code2() @@ -326,6 +328,8 @@ class ApiTest(CoverageTest): # won't make another warning. with self.assert_warnings(cov, []): cov.get_data() + # Then stop it, or the test suite gets out of whack. + cov.stop() def test_two_getdata_warn_twice(self): self.make_code1_code2() @@ -339,6 +343,8 @@ class ApiTest(CoverageTest): # Calling get_data a second time after tracing some more will warn again. with self.assert_warnings(cov, ["No data was collected"]): cov.get_data() + # Then stop it, or the test suite gets out of whack. + cov.stop() def make_good_data_files(self): """Make some good data files.""" |