From b8b1aaed4d6eaeb8cab1afa2449863fe2bd91313 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 28 Nov 2009 21:10:24 -0500 Subject: Read the data file from the COVERAGE_FILE environment variable. --HG-- branch : config --- test/test_config.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/test_config.py') 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") -- cgit v1.2.1