From 8416ddba416b9a4c12fb1033101bbca9d11ac8ca Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 25 Nov 2012 17:16:59 -0500 Subject: Config files now can use environment variables. #97. --- test/test_config.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/test_config.py b/test/test_config.py index 19e37ab9..1fdc2ce2 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -98,6 +98,30 @@ class ConfigTest(CoverageTest): """) self.assertRaises(CoverageException, coverage.coverage) + def test_environment_vars_in_config(self): + # Config files can have $envvars in them. + self.make_file(".coveragerc", """\ + [run] + data_file = $DATA_FILE.fooey + branch = $OKAY + [report] + exclude_lines = + the_$$one + another${THING} + x${THING}y + x${NOTHING}y + huh$${X}what + """) + self.set_environ("DATA_FILE", "hello-world") + self.set_environ("THING", "ZZZ") + self.set_environ("OKAY", "yes") + cov = coverage.coverage() + self.assertEqual(cov.config.data_file, "hello-world.fooey") + self.assertEqual(cov.config.branch, True) + self.assertEqual(cov.config.exclude_list, + ["the_$one", "anotherZZZ", "xZZZy", "xy", "huh${X}what"] + ) + class ConfigFileTest(CoverageTest): """Tests of the config file settings in particular.""" -- cgit v1.2.1