summaryrefslogtreecommitdiff
path: root/test/test_config.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-11-25 17:16:59 -0500
committerNed Batchelder <ned@nedbatchelder.com>2012-11-25 17:16:59 -0500
commit8416ddba416b9a4c12fb1033101bbca9d11ac8ca (patch)
treee2fab0b701bc7d9c8de4f7d3e4a65a9079508492 /test/test_config.py
parentc33865dc58bf1e0c2aaa9a935d1c8594b844dee3 (diff)
downloadpython-coveragepy-git-8416ddba416b9a4c12fb1033101bbca9d11ac8ca.tar.gz
Config files now can use environment variables. #97.
Diffstat (limited to 'test/test_config.py')
-rw-r--r--test/test_config.py24
1 files changed, 24 insertions, 0 deletions
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."""