From f828915df2b52095ea28fbc82e1219d55ae91998 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 10 Oct 2013 21:14:04 -0400 Subject: Fix the mechanism for HTML to find OS-installed resources. --- tests/test_html.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/test_html.py') 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"] -- cgit v1.2.1