diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2013-10-10 21:14:04 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2013-10-10 21:14:04 -0400 |
commit | f828915df2b52095ea28fbc82e1219d55ae91998 (patch) | |
tree | b748b898b5bf74c6a6f1722866ccfef212bd74f0 /tests/test_html.py | |
parent | 130ae623f9dba9c28ee321b6f6a1d0f0fe8f9a8a (diff) | |
download | python-coveragepy-git-f828915df2b52095ea28fbc82e1219d55ae91998.tar.gz |
Fix the mechanism for HTML to find OS-installed resources.
Diffstat (limited to 'tests/test_html.py')
-rw-r--r-- | tests/test_html.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_html.py b/tests/test_html.py index e1d41d93..06132fb4 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -317,9 +317,32 @@ class HtmlStaticFileTest(CoverageTest): cov = coverage.coverage() self.start_import_stop(cov, "main") cov.html_report() + jquery = open("htmlcov/jquery.min.js").read() self.assertEqual(jquery, "Not Really JQuery!") + def test_copying_static_files_from_system_in_dir(self): + # Make a new place for static files. + INSTALLED = [ + "jquery/jquery.min.js", + "jquery-hotkeys/jquery.hotkeys.js", + "jquery-isonscreen/jquery.isonscreen.js", + "jquery-tablesorter/jquery.tablesorter.min.js", + ] + for fpath in INSTALLED: + self.make_file(os.path.join("static_here", fpath), "Not real.") + coverage.html.STATIC_PATH.insert(0, "static_here") + + self.make_file("main.py", "print(17)") + cov = coverage.coverage() + self.start_import_stop(cov, "main") + cov.html_report() + + for fpath in INSTALLED: + the_file = os.path.basename(fpath) + contents = open(os.path.join("htmlcov", the_file)).read() + self.assertEqual(contents, "Not real.") + def test_cant_find_static_files(self): # Make the path point to useless places. coverage.html.STATIC_PATH = ["/xyzzy"] |