summaryrefslogtreecommitdiff
path: root/test/test_config.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-12-13 17:00:47 -0500
committerNed Batchelder <ned@nedbatchelder.com>2009-12-13 17:00:47 -0500
commitc63c0783755a8304a48755c99b2768460751d3cb (patch)
tree8bb82e8448de999ad5577eb58a97aadd4c447f51 /test/test_config.py
parent7db6962122caa7d6a6b2ee936730f603c97b3743 (diff)
downloadpython-coveragepy-c63c0783755a8304a48755c99b2768460751d3cb.tar.gz
Rename the config file option for excluding source lines, in prep for excluding files.
Diffstat (limited to 'test/test_config.py')
-rw-r--r--test/test_config.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/test/test_config.py b/test/test_config.py
index 4272e8a..926de18 100644
--- a/test/test_config.py
+++ b/test/test_config.py
@@ -8,7 +8,7 @@ from coveragetest import CoverageTest
class ConfigTest(CoverageTest):
- """Tests of the config file support."""
+ """Tests of the different sources of configuration settings."""
def test_default_config(self):
# Just constructing a coverage() object gets the right defaults.
@@ -87,3 +87,32 @@ class ConfigTest(CoverageTest):
# But the constructor args override the env var.
cov = coverage.coverage(data_file="fromarg.dat")
self.assertEqual(cov.config.data_file, "fromarg.dat")
+
+
+class ConfigFileTest(CoverageTest):
+ """Tests of the config file settings in particular."""
+
+ def test_config_file_settings(self):
+ self.make_file(".coveragerc", """\
+ # This is a settings file for coverage.py
+ [run]
+ timid = yes
+ data_file = something_or_other.dat
+ branch = 0
+ cover_pylib = TRUE
+
+ [report]
+ ; these settings affect reporting.
+ exclude_lines =
+ if 0:
+ pragma:?\s+no cover
+ another_tab
+ """)
+ cov = coverage.coverage()
+ self.assertFalse(cov.config.branch)
+ self.assertTrue(cov.config.timid)
+ self.assertTrue(cov.config.cover_pylib)
+ self.assertEqual(cov.config.data_file, "something_or_other.dat")
+ self.assertEqual(cov.get_exclude_list(),
+ ["if 0:", "pragma:?\s+no cover", "another_tab"]
+ )