Skip to content

Commit 27be3f5

Browse files
Temporary hack to solve test failures
1 parent a86bb59 commit 27be3f5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

testing/test_pytest_html.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,20 @@
1414
pytest_plugins = ("pytester",)
1515

1616

17+
def handle_tr_writer_deprecation():
18+
# Remove this function when they've fixed
19+
# https://github.com/pytest-dev/pytest/issues/6936
20+
import warnings
21+
from _pytest.warnings import _setoption
22+
23+
arg = "ignore:TerminalReporter.writer:pytest.PytestDeprecationWarning"
24+
_setoption(warnings, arg)
25+
26+
1727
def run(testdir, path="report.html", *args):
28+
# TODO: Temporary hack until they fix
29+
# https://github.com/pytest-dev/pytest/issues/6936
30+
handle_tr_writer_deprecation() # TODO: Temporary hack
1831
path = testdir.tmpdir.join(path)
1932
result = testdir.runpytest("--html", path, *args)
2033
return result, read_html(path)
@@ -219,6 +232,9 @@ def test_report_title(self, testdir, path):
219232
assert report_title in html
220233

221234
def test_report_title_addopts_env_var(self, testdir, monkeypatch):
235+
# TODO: Temporary hack until they fix
236+
# https://github.com/pytest-dev/pytest/issues/6936
237+
handle_tr_writer_deprecation()
222238
report_location = "REPORT_LOCATION"
223239
report_name = "MuhReport"
224240
monkeypatch.setenv(report_location, report_name)
@@ -878,6 +894,9 @@ def test_css_invalid(self, testdir, recwarn):
878894
assert "No such file or directory: 'style.css'" in result.stderr.str()
879895

880896
def test_css_invalid_no_html(self, testdir):
897+
# TODO: Temporary hack until they fix
898+
# https://github.com/pytest-dev/pytest/issues/6936
899+
handle_tr_writer_deprecation()
881900
testdir.makepyfile("def test_pass(): pass")
882901
result = testdir.runpytest("--css", "style.css")
883902
assert result.ret == 0

0 commit comments

Comments
 (0)