Skip to content

Commit 3d5e334

Browse files
authored
Merge branch 'master' into master
2 parents 618af9e + 3e1f812 commit 3d5e334

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

pytest_html/plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def pytest_configure(config):
6868
htmlpath = config.getoption("htmlpath")
6969
if htmlpath:
7070
for csspath in config.getoption("css"):
71-
open(csspath)
71+
if not os.path.exists(csspath):
72+
raise IOError(f"No such file or directory: '{csspath}'")
7273
if not hasattr(config, "slaveinput"):
7374
# prevent opening htmlpath on slave nodes (xdist)
7475
config._html = HTMLReport(htmlpath, config)

pytest_html/resources/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function init () {
111111

112112
show_filters();
113113

114-
toggle_sort_states(find('.initial-sort'));
114+
sort_column(find('.initial-sort'));
115115

116116
find_all('.sortable').forEach(function(elem) {
117117
elem.addEventListener("click",

testing/test_pytest_html.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ def test_pass(): pass
759759
assert re.search(regex_error, html) is not None
760760

761761
@pytest.mark.parametrize("colors", [(["red"]), (["green", "blue"])])
762-
def test_css(self, testdir, colors):
762+
def test_css(self, testdir, recwarn, colors):
763763
testdir.makepyfile("def test_pass(): pass")
764764
css = {}
765765
cssargs = []
@@ -770,14 +770,16 @@ def test_css(self, testdir, colors):
770770
cssargs.extend(["--css", path])
771771
result, html = run(testdir, "report.html", "--self-contained-html", *cssargs)
772772
assert result.ret == 0
773+
assert len(recwarn) == 0
773774
for k, v in css.items():
774775
assert str(v["path"]) in html
775776
assert v["style"] in html
776777

777-
def test_css_invalid(self, testdir):
778+
def test_css_invalid(self, testdir, recwarn):
778779
testdir.makepyfile("def test_pass(): pass")
779780
result = testdir.runpytest("--html", "report.html", "--css", "style.css")
780781
assert result.ret
782+
assert len(recwarn) == 0
781783
assert "No such file or directory: 'style.css'" in result.stderr.str()
782784

783785
def test_css_invalid_no_html(self, testdir):

0 commit comments

Comments
 (0)