diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-04-19 07:01:14 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-04-19 07:01:14 -0400 |
commit | 3d3dfc871f102f64737883ea78777a89b6126794 (patch) | |
tree | cd79a6f6d9dd883dca3a4cd76452c888be33340c /tests/test_config.py | |
parent | ee02b2054674f583349c7c136d81690062e05e6f (diff) | |
download | python-coveragepy-git-3d3dfc871f102f64737883ea78777a89b6126794.tar.gz |
COVERAGE_RCFILE can specify the config file location. #650
Diffstat (limited to 'tests/test_config.py')
-rw-r--r-- | tests/test_config.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index 0b4d40b6..bbfa4677 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -103,6 +103,21 @@ class ConfigTest(CoverageTest): cov = coverage.Coverage() self.assertEqual(cov.config.debug, ["dataio", "pids", "callers", "fooey"]) + def test_rcfile_from_environment(self): + self.make_file("here.ini", """\ + [run] + data_file = overthere.dat + """) + self.set_environ("COVERAGE_RCFILE", "here.ini") + cov = coverage.Coverage() + self.assertEqual(cov.config.data_file, "overthere.dat") + + def test_missing_rcfile_from_environment(self): + self.set_environ("COVERAGE_RCFILE", "nowhere.ini") + msg = "Couldn't read 'nowhere.ini' as a config file" + with self.assertRaisesRegex(CoverageException, msg): + coverage.Coverage() + def test_parse_errors(self): # Im-parsable values raise CoverageException, with details. bad_configs_and_msgs = [ |