summaryrefslogtreecommitdiff
path: root/tests/test_html.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-10-23 11:27:52 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-10-23 17:34:53 -0400
commitbb2bc1a6295ee8fc4f3cccfe72aeb3d3ae5246cb (patch)
tree09ec0e9c4ae2dc14d20bd2f7cb0c07f4d6020148 /tests/test_html.py
parentb5a53740700e59dbebbf655d4914bbaf9470870a (diff)
downloadpython-coveragepy-git-bb2bc1a6295ee8fc4f3cccfe72aeb3d3ae5246cb.tar.gz
refactor: no more need for a search path for static files
We used to search an OS-specific directory in addition to our own, specifically so that Debian could use an OS-installed copy of jQuery and its plugins. But we no longer have jQuery or any third-party JavaScript code, so we don't need to search the Debian directories.
Diffstat (limited to 'tests/test_html.py')
-rw-r--r--tests/test_html.py58
1 files changed, 1 insertions, 57 deletions
diff --git a/tests/test_html.py b/tests/test_html.py
index 06dcb886..fa60952d 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -16,7 +16,7 @@ import pytest
import coverage
from coverage import env
-from coverage.exceptions import CoverageException, NotPython, NoSource
+from coverage.exceptions import NotPython, NoSource
from coverage.files import abs_file, flat_rootname
import coverage.html
from coverage.report import get_analysis_to_report
@@ -555,62 +555,6 @@ class HtmlTest(HtmlTestHelpers, CoverageTest):
self.assert_doesnt_exist("htmlcov/submodule___init___py.html")
-class HtmlStaticFileTest(CoverageTest):
- """Tests of the static file copying for the HTML report."""
-
- def setup_test(self):
- super().setup_test()
- original_path = list(coverage.html.STATIC_PATH)
- self.addCleanup(setattr, coverage.html, 'STATIC_PATH', original_path)
-
- def test_copying_static_files_from_system(self):
- # Make a new place for static files.
- self.make_file("static_here/jquery.min.js", "Not Really JQuery!")
- 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()
-
- with open("htmlcov/jquery.min.js") as f:
- jquery = f.read()
- assert 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)
- with open(os.path.join("htmlcov", the_file)) as f:
- contents = f.read()
- assert contents == "Not real."
-
- def test_cant_find_static_files(self):
- # Make the path point to useless places.
- coverage.html.STATIC_PATH = ["/xyzzy"]
-
- self.make_file("main.py", "print(17)")
- cov = coverage.Coverage()
- self.start_import_stop(cov, "main")
- msg = "Couldn't find static file '.*'"
- with pytest.raises(CoverageException, match=msg):
- cov.html_report()
-
def filepath_to_regex(path):
"""Create a regex for scrubbing a file path."""
regex = re.escape(path)