From cadcb4ca7a7d26589e5d42df1b4494636c39ed61 Mon Sep 17 00:00:00 2001 From: loic Date: Fri, 16 Dec 2016 13:29:18 +0100 Subject: --source and --include are mutually exclusive #265 Add a sanity_check function to CoverageConfig to perform sanity checks after configuration values have been collected from files, arguments etc. Raise an error if --source and --include are both set. The config tests are amended because some of them have both source and include set. Based on the original patch from Nathan Land close #265 --- tests/test_cmdline.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/test_cmdline.py') diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 3b982eb..3b674de 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -16,7 +16,7 @@ import coverage.cmdline from coverage import env from coverage.config import CoverageConfig from coverage.data import CoverageData, CoverageDataFiles -from coverage.misc import ExceptionDuringRun +from coverage.misc import CoverageException, ExceptionDuringRun from tests.coveragetest import CoverageTest, OK, ERR @@ -459,6 +459,10 @@ class CmdLineTest(BaseCmdLineTest): .save() """) + def test_bad_run_args_with_both_source_and_include(self): + with self.assertRaisesRegex(CoverageException, 'mutually exclusive'): + self.command_line("run --include=pre1,pre2 --source=lol,wut foo.py", ret=ERR) + def test_bad_concurrency(self): self.command_line("run --concurrency=nothing", ret=ERR) out = self.stdout() -- cgit v1.2.1