diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-10-21 15:16:04 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-10-21 15:16:04 -0400 |
commit | cb77fe4a51589614d4870cdf2d5bd7ee2524f4d5 (patch) | |
tree | 9b3312425bf3df099c902e51ffc594f3197ed0b9 | |
parent | 15f879b94b06d268f74c195a5614c7ca429363ce (diff) | |
download | python-coveragepy-git-cb77fe4a51589614d4870cdf2d5bd7ee2524f4d5.tar.gz |
Test the debug settings more, and strip spaces from the environment variable
-rw-r--r-- | coverage/control.py | 2 | ||||
-rw-r--r-- | coverage/data.py | 2 | ||||
-rw-r--r-- | tests/test_config.py | 11 |
3 files changed, 13 insertions, 2 deletions
diff --git a/coverage/control.py b/coverage/control.py index f7be083d..8bca939c 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -162,7 +162,7 @@ class Coverage(object): self.config.data_file = env_data_file debugs = os.environ.get('COVERAGE_DEBUG') if debugs: - self.config.debug.extend(debugs.split(",")) + self.config.debug.extend(d.strip() for d in debugs.split(",")) # 4: from constructor arguments: self.config.from_args( diff --git a/coverage/data.py b/coverage/data.py index bd114627..50b309af 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -719,7 +719,7 @@ class CoverageDataFiles(object): raise CoverageException("No data to combine") for f in files_to_combine: - new_data = CoverageData() + new_data = CoverageData(debug=self.debug) try: new_data.read_file(f) except CoverageException as exc: diff --git a/tests/test_config.py b/tests/test_config.py index cf8a6a7f..1c980b86 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -95,6 +95,15 @@ class ConfigTest(CoverageTest): cov = coverage.Coverage(data_file="fromarg.dat") self.assertEqual(cov.config.data_file, "fromarg.dat") + def test_debug_from_environment(self): + self.make_file(".coveragerc", """\ + [run] + debug = dataio, pids + """) + self.set_environ("COVERAGE_DEBUG", "callers, fooey") + cov = coverage.Coverage() + self.assertEqual(cov.config.debug, ["dataio", "pids", "callers", "fooey"]) + def test_parse_errors(self): # Im-parsable values raise CoverageException, with details. bad_configs_and_msgs = [ @@ -236,6 +245,7 @@ class ConfigFileTest(CoverageTest): plugins = plugins.a_plugin plugins.another + debug = callers, pids , dataio [{section}report] ; these settings affect reporting. @@ -300,6 +310,7 @@ class ConfigFileTest(CoverageTest): self.assertEqual(cov.config.data_file, "something_or_other.dat") self.assertTrue(cov.config.branch) self.assertTrue(cov.config.cover_pylib) + self.assertEqual(cov.config.debug, ["callers", "pids", "dataio"]) self.assertTrue(cov.config.parallel) self.assertEqual(cov.config.concurrency, ["thread"]) self.assertEqual(cov.config.source, ["myapp"]) |