diff options
author | loic@dachary.org <loic@dachary.org> | 2017-01-06 15:42:56 +0100 |
---|---|---|
committer | loic@dachary.org <loic@dachary.org> | 2017-01-06 15:42:56 +0100 |
commit | bcc6d71c52207fa4808f14234231af7d399b975f (patch) | |
tree | 6fd982d58f1434c6f438934afba4fae368fb8f67 /tests/test_process.py | |
parent | 6d5ebb6b653b9551c78383e23309860f1f650ba3 (diff) | |
download | python-coveragepy-git-bcc6d71c52207fa4808f14234231af7d399b975f.tar.gz |
make --source module do the same as --source directory #426
The --source argument can either be a module or a directory. The user
expects that it behaves the same in both cases. Make sure the module
is recursively explored so that files that are not run show in the
coverage report.
close #426
--HG--
branch : issue-426
Diffstat (limited to 'tests/test_process.py')
-rw-r--r-- | tests/test_process.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_process.py b/tests/test_process.py index be9bdb76..a9e8d4c6 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -505,6 +505,15 @@ class ProcessTest(CoverageTest): self.assertEqual(st, 0) self.assertEqual(self.line_count(out), 6, out) + def test_coverage_doubledashsource_module(self): + """ pkg1.sub is not a directory, verify the files it contains + and that were not run show in the report """ + out = self.run_command("coverage run --source pkg1.sub -m pkg1.sub arg") + self.assertIn('pkg1.sub.__main__: passed', out) + st, out = self.run_command_status("coverage report") + self.assertEqual(st, 0) + self.assertIn('runmod3.py', out) + def test_coverage_run_script_imports_doubledashsource(self): # This file imports try_execfile, which compiles it to .pyc, so the # first run will have __file__ == "try_execfile.py" and the second will |