summaryrefslogtreecommitdiff
path: root/tests/test_execfile.py
diff options
context:
space:
mode:
authorNed Batchelder <nedbat@gmail.com>2015-08-01 12:53:22 -0400
committerNed Batchelder <nedbat@gmail.com>2015-08-01 12:53:22 -0400
commit3e6e85a71c1ad66cd8ed658a61bedbff38f47dd1 (patch)
treef20b99c588069103d2b5fec373b960de05b4c0d6 /tests/test_execfile.py
parentdb337283466520c76334c382d0492a1e8f92aa2d (diff)
parentb3310c1889fc5f53275f6e9b2baa2a8b5d1a1d91 (diff)
downloadpython-coveragepy-git-3e6e85a71c1ad66cd8ed658a61bedbff38f47dd1.tar.gz
Merged in traff/coverage.py (pull request #50)
Look for __main__ module if coverage is being run for directory #252
Diffstat (limited to 'tests/test_execfile.py')
-rw-r--r--tests/test_execfile.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_execfile.py b/tests/test_execfile.py
index 2a0ca05c..2533f81d 100644
--- a/tests/test_execfile.py
+++ b/tests/test_execfile.py
@@ -85,6 +85,15 @@ class RunFileTest(CoverageTest):
with self.assertRaises(NoSource):
run_python_file("xyzzy.py", [])
+ def test_directory_with_main(self):
+ directory_with_main = os.path.join(HERE, "with_main")
+ run_python_file(directory_with_main, [directory_with_main])
+ self.assertEqual(self.stdout(), "1\n")
+
+ def test_directory_without_main(self):
+ with self.assertRaises(NoSource):
+ directory_with_main = os.path.join(HERE, "with_main", "without")
+ run_python_file(directory_with_main, [directory_with_main])
class RunPycFileTest(CoverageTest):
"""Test cases for `run_python_file`."""