summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-11-28 21:10:24 -0500
committerNed Batchelder <ned@nedbatchelder.com>2009-11-28 21:10:24 -0500
commitb8b1aaed4d6eaeb8cab1afa2449863fe2bd91313 (patch)
treecd60550e2158fd3d731c28ad9ca51f0d1d3f78c5 /test
parent7cc3c763513ccdb6d6e783db668f742944495f43 (diff)
downloadpython-coveragepy-git-b8b1aaed4d6eaeb8cab1afa2449863fe2bd91313.tar.gz
Read the data file from the COVERAGE_FILE environment variable.
--HG-- branch : config
Diffstat (limited to 'test')
-rw-r--r--test/test_config.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_config.py b/test/test_config.py
index 06d43d31..a1abf51b 100644
--- a/test/test_config.py
+++ b/test/test_config.py
@@ -73,3 +73,17 @@ class ConfigTest(CoverageTest):
self.assertFalse(cov.config.timid)
self.assertFalse(cov.config.branch)
self.assertEqual(cov.config.data_file, ".mycov")
+
+ def test_data_file_from_environment(self):
+ # There's an environment variable for the data_file.
+ self.make_file(".coveragerc", """\
+ [run]
+ timid = True
+ data_file = weirdo.file
+ """)
+ self.set_environ("COVERAGE_FILE", "fromenv.dat")
+ cov = coverage.coverage()
+ self.assertEqual(cov.config.data_file, "fromenv.dat")
+ # But the constructor args override the env var.
+ cov = coverage.coverage(data_file="fromarg.dat")
+ self.assertEqual(cov.config.data_file, "fromarg.dat")