summaryrefslogtreecommitdiff
path: root/test/test_html.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-11-23 21:54:56 -0500
committerNed Batchelder <ned@nedbatchelder.com>2012-11-23 21:54:56 -0500
commit40c37c04c11840bf85652af5b0128a1ee7bd69de (patch)
treeba04834fccad98aba8d452e1986d615b948cfe07 /test/test_html.py
parent289aa97e1582002dd2407acf4654c968b2349571 (diff)
downloadpython-coveragepy-git-40c37c04c11840bf85652af5b0128a1ee7bd69de.tar.gz
If a file is missing, don't show an error message with the wrong path. #60.
Diffstat (limited to 'test/test_html.py')
-rw-r--r--test/test_html.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/test_html.py b/test/test_html.py
index 29106562..2f1dc5d2 100644
--- a/test/test_html.py
+++ b/test/test_html.py
@@ -3,7 +3,7 @@
import os.path, sys
import coverage
-from coverage.misc import NotPython
+from coverage.misc import NotPython, NoSource
sys.path.insert(0, os.path.split(__file__)[0]) # Force relative import for Py3k
from coveragetest import CoverageTest
@@ -287,3 +287,24 @@ class HtmlWithUnparsableFilesTest(CoverageTest):
cov.stop()
cov.html_report()
self.assert_exists("htmlcov/index.html")
+
+
+class HtmlTest(CoverageTest):
+ """Moar HTML tests."""
+
+ def test_missing_source_file_incorrect_message(self):
+ # https://bitbucket.org/ned/coveragepy/issue/60
+ self.make_file("thefile.py", "import sub.another\n")
+ self.make_file("sub/__init__.py", "")
+ self.make_file("sub/another.py", "print('another')\n")
+ cov = coverage.coverage()
+ cov.start()
+ self.import_local_file('thefile')
+ cov.stop()
+ os.remove("sub/another.py")
+
+ missing_file = os.path.join(self.temp_dir, "sub", "another.py")
+ self.assertRaisesRegexp(NoSource,
+ "No source for code: '%s'" % missing_file,
+ cov.html_report
+ )