pytest-html
pytest-html copied to clipboard
3.1.1: pytest is failing
+++ pytest is failing I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation- because I'm calling
buildwith--no-isolationI'm using during all processes only locally installed modules - install .whl file in </install/prefix>
- run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-html-3.1.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-html-3.1.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1, configfile: tox.ini, testpaths: testing
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 89 items
testing/test_pytest_html.py FFFFFFFF.FFFFF............................FFFF.........FF......FFF....F.......FF.FFFFFFFF [100%]
================================================================================= FAILURES =================================================================================
_________________________________________________________________________ TestHTML.test_durations __________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df25ca0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_durations0')>
def test_durations(self, testdir):
sleep = float(0.2)
testdir.makepyfile(
"""
import time
def test_sleep():
time.sleep({:f})
""".format(
sleep * 2
)
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, duration=sleep)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:113:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_durations0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_durations.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_durations0/report.html -
============================== 1 passed in 0.43s ===============================
____________________________________________ TestHTML.test_can_format_duration_column[%f-<td class="col-duration">\\d{2}</td>] _____________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df22160>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_can_format_duration_column0')>
duration_formatter = '%f', expected_report_content = '<td class="col-duration">\\d{2}</td>'
@pytest.mark.parametrize(
"duration_formatter,expected_report_content",
[
("%f", r'<td class="col-duration">\d{2}</td>'),
("%S.%f", r'<td class="col-duration">\d{2}\.\d{2}</td>'),
(
"ABC%H %M %S123",
r'<td class="col-duration">ABC\d{2} \d{2} \d{2}123</td>',
),
],
)
def test_can_format_duration_column(
self, testdir, duration_formatter, expected_report_content
):
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
setattr(report, "duration_formatter", "{duration_formatter}")
"""
)
sleep = float(0.2)
testdir.makepyfile(
"""
import time
def test_sleep():
time.sleep({:f})
""".format(
sleep
)
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, duration=sleep)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:157:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_can_format_duration_column0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_can_format_duration_column.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_can_format_duration_column0/report.html -
============================== 1 passed in 0.22s ===============================
______________________________________ TestHTML.test_can_format_duration_column[%S.%f-<td class="col-duration">\\d{2}\\.\\d{2}</td>] _______________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df221f0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_can_format_duration_column1')>
duration_formatter = '%S.%f', expected_report_content = '<td class="col-duration">\\d{2}\\.\\d{2}</td>'
@pytest.mark.parametrize(
"duration_formatter,expected_report_content",
[
("%f", r'<td class="col-duration">\d{2}</td>'),
("%S.%f", r'<td class="col-duration">\d{2}\.\d{2}</td>'),
(
"ABC%H %M %S123",
r'<td class="col-duration">ABC\d{2} \d{2} \d{2}123</td>',
),
],
)
def test_can_format_duration_column(
self, testdir, duration_formatter, expected_report_content
):
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
setattr(report, "duration_formatter", "{duration_formatter}")
"""
)
sleep = float(0.2)
testdir.makepyfile(
"""
import time
def test_sleep():
time.sleep({:f})
""".format(
sleep
)
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, duration=sleep)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:157:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_can_format_duration_column1
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_can_format_duration_column.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_can_format_duration_column1/report.html -
============================== 1 passed in 0.22s ===============================
___________________________ TestHTML.test_can_format_duration_column[ABC%H %M %S123-<td class="col-duration">ABC\\d{2} \\d{2} \\d{2}123</td>] ____________________________
self = <test_pytest_html.TestHTML object at 0x7f693df22040>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_can_format_duration_column2')>
duration_formatter = 'ABC%H %M %S123', expected_report_content = '<td class="col-duration">ABC\\d{2} \\d{2} \\d{2}123</td>'
@pytest.mark.parametrize(
"duration_formatter,expected_report_content",
[
("%f", r'<td class="col-duration">\d{2}</td>'),
("%S.%f", r'<td class="col-duration">\d{2}\.\d{2}</td>'),
(
"ABC%H %M %S123",
r'<td class="col-duration">ABC\d{2} \d{2} \d{2}123</td>',
),
],
)
def test_can_format_duration_column(
self, testdir, duration_formatter, expected_report_content
):
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
setattr(report, "duration_formatter", "{duration_formatter}")
"""
)
sleep = float(0.2)
testdir.makepyfile(
"""
import time
def test_sleep():
time.sleep({:f})
""".format(
sleep
)
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, duration=sleep)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:157:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_can_format_duration_column2
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_can_format_duration_column.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_can_format_duration_column2/report.html -
============================== 1 passed in 0.22s ===============================
____________________________________________________________________________ TestHTML.test_pass ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df22f40>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_pass0')>
def test_pass(self, testdir):
testdir.makepyfile("def test_pass(): pass")
result, html = run(testdir)
assert result.ret == 0
> assert_results(html)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:166:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_pass0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_pass.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_pass0/report.html -
============================== 1 passed in 0.01s ===============================
____________________________________________________________________________ TestHTML.test_skip ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df22910>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_skip0')>
def test_skip(self, testdir):
reason = str(random.random())
testdir.makepyfile(
f"""
import pytest
def test_skip():
pytest.skip('{reason}')
"""
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, tests=0, passed=0, skipped=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:179:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...p0/test_skip.py', 3, 'Skipped: 0.43798765196155964')<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_skip0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_skip.py s [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_skip0/report.html -
============================== 1 skipped in 0.01s ==============================
____________________________________________________________________________ TestHTML.test_fail ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e0ad4c0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_fail0')>
def test_fail(self, testdir):
testdir.makepyfile("def test_fail(): assert False")
result, html = run(testdir)
assert result.ret
> assert_results(html, passed=0, failed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:186:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...or">E assert False</span><br/><br/>test_fail.py:1: AssertionError<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_fail0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_fail.py F [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
> def test_fail(): assert False
E assert False
test_fail.py:1: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_fail0/report.html -
=========================== short test summary info ============================
FAILED test_fail.py::test_fail - assert False
============================== 1 failed in 0.01s ===============================
___________________________________________________________________________ TestHTML.test_rerun ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693dfd1ac0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_rerun0')>
def test_rerun(self, testdir):
testdir.makeconftest(
"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
pytest_html = item.config.pluginmanager.getplugin("html")
outcome = yield
report = outcome.get_result()
extra = getattr(report, "extra", [])
if report.when == "call":
extra.append(pytest_html.extras.url("http://www.example.com/"))
report.extra = extra
"""
)
testdir.makepyfile(
"""
import pytest
import time
@pytest.mark.flaky(reruns=2)
def test_example():
time.sleep(1)
assert False
"""
)
result, html = run(testdir)
assert result.ret
> assert_results(html, passed=0, failed=1, rerun=2)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:221:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset... assert False</span><br/><br/>test_rerun.py:7: AssertionError<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 2, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_rerun0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_rerun.py F [100%]
=================================== FAILURES ===================================
_________________________________ test_example _________________________________
@pytest.mark.flaky(reruns=2)
def test_example():
time.sleep(1)
> assert False
E assert False
test_rerun.py:7: AssertionError
=============================== warnings summary ===============================
test_rerun.py:4
/tmp/pytest-of-tkloczko/pytest-259/test_rerun0/test_rerun.py:4: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.flaky(reruns=2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_rerun0/report.html -
=========================== short test summary info ============================
FAILED test_rerun.py::test_example - assert False
========================= 1 failed, 1 warning in 1.03s =========================
_____________________________________________________________________ TestHTML.test_conditional_xfails _____________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693ddfd670>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_conditional_xfails0')>
def test_conditional_xfails(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.mark.xfail(False, reason='reason')
def test_fail(): assert False
@pytest.mark.xfail(False, reason='reason')
def test_pass(): pass
@pytest.mark.xfail(True, reason='reason')
def test_xfail(): assert False
@pytest.mark.xfail(True, reason='reason')
def test_xpass(): pass
"""
)
result, html = run(testdir)
assert result.ret
> assert_results(html, tests=4, passed=1, failed=1, xfailed=1, xpassed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_conditional_xfails0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 4 items
test_conditional_xfails.py F.xX [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
@pytest.mark.xfail(False, reason='reason')
> def test_fail(): assert False
E assert False
test_conditional_xfails.py:3: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_conditional_xfails0/report.html -
=========================== short test summary info ============================
FAILED test_conditional_xfails.py::test_fail - assert False
============== 1 failed, 1 passed, 1 xfailed, 1 xpassed in 0.02s ===============
________________________________________________________________________ TestHTML.test_setup_error _________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693ddfd8e0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_setup_error0')>
def test_setup_error(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.fixture
def arg(request):
raise ValueError()
def test_function(arg):
pass
"""
)
result, html = run(testdir)
assert result.ret
> assert_results(html, tests=0, passed=0, errors=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:269:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset... ValueError</span><br/><br/>test_setup_error.py:4: ValueError<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_setup_error0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_setup_error.py E [100%]
==================================== ERRORS ====================================
_______________________ ERROR at setup of test_function ________________________
request = <SubRequest 'arg' for <Function test_function>>
@pytest.fixture
def arg(request):
> raise ValueError()
E ValueError
test_setup_error.py:4: ValueError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_setup_error0/report.html -
=========================== short test summary info ============================
ERROR test_setup_error.py::test_function - ValueError
=============================== 1 error in 0.01s ===============================
___________________________________________________________________________ TestHTML.test_xfail ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693ddfd7c0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_xfail0')>
def test_xfail(self, testdir):
reason = str(random.random())
testdir.makepyfile(
f"""
import pytest
def test_xfail():
pytest.xfail('{reason}')
"""
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, passed=0, xfailed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:284:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...Failed: 0.3038467227856291</span><br/><br/>test_xfail.py:3: XFailed<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_xfail0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_xfail.py x [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_xfail0/report.html -
============================== 1 xfailed in 0.01s ==============================
___________________________________________________________________________ TestHTML.test_xpass ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df346d0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_xpass0')>
def test_xpass(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.mark.xfail()
def test_xpass():
pass
"""
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, passed=0, xpassed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:298:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_xpass0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_xpass.py X [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_xpass0/report.html -
============================== 1 xpassed in 0.01s ==============================
_____________________________________________________________________ TestHTML.test_create_report_path _____________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df30d90>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_create_report_path0')>
def test_create_report_path(self, testdir):
testdir.makepyfile("def test_pass(): pass")
path = os.path.join("directory", "report.html")
result, html = run(testdir, path)
assert result.ret == 0
> assert_results(html)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:305:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_create_report_path0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_create_report_path.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_create_report_path0/directory/report.html -
============================== 1 passed in 0.01s ===============================
___________________________________________________________ TestHTML.test_extra_image_separated_rerun[png-image] ___________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df31640>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun0')>
file_extension = 'png', extra_type = 'image'
@pytest.mark.parametrize(
"file_extension, extra_type",
[("png", "image"), ("png", "png"), ("svg", "svg"), ("jpg", "jpg")],
)
def test_extra_image_separated_rerun(self, testdir, file_extension, extra_type):
content = b64encode(b"foo").decode("ascii")
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
if report.when == 'call':
from pytest_html import extras
report.extra = [extras.{extra_type}('{content}')]
"""
)
testdir.makepyfile(
"""
import pytest
@pytest.mark.flaky(reruns=2)
def test_fail():
assert False"""
)
result, html = run(testdir)
for i in range(1, 4):
asset_name = "test_extra_image_separated_rerun.py__test_fail"
src = f"assets/{asset_name}_0_{i}.{file_extension}"
link = f'<a class="image" href="{src}" target="_blank">'
img = f'<img src="{src}"/>'
assert result.ret
> assert link in html
E assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test_fail_0_1.png" target="_blank">' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...pan><br/><br/>test_extra_image_separated_rerun.py:4: AssertionError<br/></div></td></tr></tbody></table></body></html>'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:631: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_extra_image_separated_rerun.py F [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
@pytest.mark.flaky(reruns=2)
def test_fail():
> assert False
E assert False
test_extra_image_separated_rerun.py:4: AssertionError
=============================== warnings summary ===============================
test_extra_image_separated_rerun.py:2
/tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun0/test_extra_image_separated_rerun.py:2: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.flaky(reruns=2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun0/report.html -
=========================== short test summary info ============================
FAILED test_extra_image_separated_rerun.py::test_fail - assert False
========================= 1 failed, 1 warning in 0.01s =========================
____________________________________________________________ TestHTML.test_extra_image_separated_rerun[png-png] ____________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df31070>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun1')>
file_extension = 'png', extra_type = 'png'
@pytest.mark.parametrize(
"file_extension, extra_type",
[("png", "image"), ("png", "png"), ("svg", "svg"), ("jpg", "jpg")],
)
def test_extra_image_separated_rerun(self, testdir, file_extension, extra_type):
content = b64encode(b"foo").decode("ascii")
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
if report.when == 'call':
from pytest_html import extras
report.extra = [extras.{extra_type}('{content}')]
"""
)
testdir.makepyfile(
"""
import pytest
@pytest.mark.flaky(reruns=2)
def test_fail():
assert False"""
)
result, html = run(testdir)
for i in range(1, 4):
asset_name = "test_extra_image_separated_rerun.py__test_fail"
src = f"assets/{asset_name}_0_{i}.{file_extension}"
link = f'<a class="image" href="{src}" target="_blank">'
img = f'<img src="{src}"/>'
assert result.ret
> assert link in html
E assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test_fail_0_1.png" target="_blank">' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...pan><br/><br/>test_extra_image_separated_rerun.py:4: AssertionError<br/></div></td></tr></tbody></table></body></html>'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:631: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun1
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_extra_image_separated_rerun.py F [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
@pytest.mark.flaky(reruns=2)
def test_fail():
> assert False
E assert False
test_extra_image_separated_rerun.py:4: AssertionError
=============================== warnings summary ===============================
test_extra_image_separated_rerun.py:2
/tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun1/test_extra_image_separated_rerun.py:2: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.flaky(reruns=2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun1/report.html -
=========================== short test summary info ============================
FAILED test_extra_image_separated_rerun.py::test_fail - assert False
========================= 1 failed, 1 warning in 0.01s =========================
____________________________________________________________ TestHTML.test_extra_image_separated_rerun[svg-svg] ____________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df31d30>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun2')>
file_extension = 'svg', extra_type = 'svg'
@pytest.mark.parametrize(
"file_extension, extra_type",
[("png", "image"), ("png", "png"), ("svg", "svg"), ("jpg", "jpg")],
)
def test_extra_image_separated_rerun(self, testdir, file_extension, extra_type):
content = b64encode(b"foo").decode("ascii")
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
if report.when == 'call':
from pytest_html import extras
report.extra = [extras.{extra_type}('{content}')]
"""
)
testdir.makepyfile(
"""
import pytest
@pytest.mark.flaky(reruns=2)
def test_fail():
assert False"""
)
result, html = run(testdir)
for i in range(1, 4):
asset_name = "test_extra_image_separated_rerun.py__test_fail"
src = f"assets/{asset_name}_0_{i}.{file_extension}"
link = f'<a class="image" href="{src}" target="_blank">'
img = f'<img src="{src}"/>'
assert result.ret
> assert link in html
E assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test_fail_0_1.svg" target="_blank">' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...pan><br/><br/>test_extra_image_separated_rerun.py:4: AssertionError<br/></div></td></tr></tbody></table></body></html>'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:631: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun2
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_extra_image_separated_rerun.py F [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
@pytest.mark.flaky(reruns=2)
def test_fail():
> assert False
E assert False
test_extra_image_separated_rerun.py:4: AssertionError
=============================== warnings summary ===============================
test_extra_image_separated_rerun.py:2
/tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun2/test_extra_image_separated_rerun.py:2: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.flaky(reruns=2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun2/report.html -
=========================== short test summary info ============================
FAILED test_extra_image_separated_rerun.py::test_fail - assert False
========================= 1 failed, 1 warning in 0.01s =========================
____________________________________________________________ TestHTML.test_extra_image_separated_rerun[jpg-jpg] ____________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df31670>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun3')>
file_extension = 'jpg', extra_type = 'jpg'
@pytest.mark.parametrize(
"file_extension, extra_type",
[("png", "image"), ("png", "png"), ("svg", "svg"), ("jpg", "jpg")],
)
def test_extra_image_separated_rerun(self, testdir, file_extension, extra_type):
content = b64encode(b"foo").decode("ascii")
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
if report.when == 'call':
from pytest_html import extras
report.extra = [extras.{extra_type}('{content}')]
"""
)
testdir.makepyfile(
"""
import pytest
@pytest.mark.flaky(reruns=2)
def test_fail():
assert False"""
)
result, html = run(testdir)
for i in range(1, 4):
asset_name = "test_extra_image_separated_rerun.py__test_fail"
src = f"assets/{asset_name}_0_{i}.{file_extension}"
link = f'<a class="image" href="{src}" target="_blank">'
img = f'<img src="{src}"/>'
assert result.ret
> assert link in html
E assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test_fail_0_1.jpg" target="_blank">' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...pan><br/><br/>test_extra_image_separated_rerun.py:4: AssertionError<br/></div></td></tr></tbody></table></body></html>'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:631: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun3
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_extra_image_separated_rerun.py F [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
@pytest.mark.flaky(reruns=2)
def test_fail():
> assert False
E assert False
test_extra_image_separated_rerun.py:4: AssertionError
=============================== warnings summary ===============================
test_extra_image_separated_rerun.py:2
/tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun3/test_extra_image_separated_rerun.py:2: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.flaky(reruns=2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_extra_image_separated_rerun3/report.html -
=========================== short test summary info ============================
FAILED test_extra_image_separated_rerun.py::test_fail - assert False
========================= 1 failed, 1 warning in 0.01s =========================
_____________________________________________________________________ TestHTML.test_environment_xdist ______________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df26d00>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_environment_xdist0')>
def test_environment_xdist(self, testdir):
content = str(random.random())
testdir.makeconftest(
f"""
def pytest_configure(config):
for i in range(2):
config._metadata['content'] = '{content}'
"""
)
testdir.makepyfile("def test_pass(): pass")
> result, html = run(testdir, "report.html", "-n", "1")
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:770:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:42: in run
return result, read_html(path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = local('/tmp/pytest-of-tkloczko/pytest-259/test_environment_xdist0/report.html')
def read_html(path):
> with open(str(path)) as f:
E FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-259/test_environment_xdist0/report.html'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:46: FileNotFoundError
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n
inifile: None
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_environment_xdist0
__________________________________________________________________ TestHTML.test_environment_xdist_reruns __________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df268e0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_environment_xdist_reruns0')>
def test_environment_xdist_reruns(self, testdir):
content = str(random.random())
testdir.makeconftest(
f"""
def pytest_configure(config):
for i in range(2):
config._metadata['content'] = '{content}'
"""
)
testdir.makepyfile("def test_fail(): assert False")
> result, html = run(testdir, "report.html", "-n", "1", "--reruns", "1")
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:785:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:42: in run
return result, read_html(path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = local('/tmp/pytest-of-tkloczko/pytest-259/test_environment_xdist_reruns0/report.html')
def read_html(path):
> with open(str(path)) as f:
E FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-259/test_environment_xdist_reruns0/report.html'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:46: FileNotFoundError
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n --reruns 1
inifile: None
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_environment_xdist_reruns0
___________________________________________________________________ TestHTML.test_xdist_crashing_worker ____________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df26b80>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_xdist_crashing_worker0')>
def test_xdist_crashing_worker(self, testdir):
"""https://github.com/pytest-dev/pytest-html/issues/21"""
testdir.makepyfile(
"""
import os
def test_exit():
os._exit(0)
"""
)
> result, html = run(testdir, "report.html", "-n", "1")
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:42: in run
return result, read_html(path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = local('/tmp/pytest-of-tkloczko/pytest-259/test_xdist_crashing_worker0/report.html')
def read_html(path):
> with open(str(path)) as f:
E FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-259/test_xdist_crashing_worker0/report.html'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:46: FileNotFoundError
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n
inifile: None
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_xdist_crashing_worker0
_______________________________________________________________________ TestHTML.test_utf8_surrogate _______________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693df26370>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_utf8_surrogate0')>
def test_utf8_surrogate(self, testdir):
testdir.makepyfile(
r"""
import pytest
@pytest.mark.parametrize('val', ['\ud800'])
def test_foo(val):
pass
"""
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, passed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:898:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_utf8_surrogate0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_utf8_surrogate.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_utf8_surrogate0/report.html -
============================== 1 passed in 0.01s ===============================
______________________________________________________________________ TestHTML.test_ansi_color[True] ______________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e175250>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_ansi_color0')>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f693d955d30>, with_ansi = True
@pytest.mark.parametrize(
"with_ansi", [True, False],
)
def test_ansi_color(self, testdir, mocker, with_ansi):
if not with_ansi:
mock_ansi_support = mocker.patch("pytest_html.plugin.ansi_support")
mock_ansi_support.return_value = None
pass_content = [
'<span class="ansi31">RCOLOR',
'<span class="ansi32">GCOLOR',
'<span class="ansi33">YCOLOR',
]
testdir.makepyfile(
r"""
def test_ansi():
colors = ['\033[31mRCOLOR\033[0m', '\033[32mGCOLOR\033[0m',
'\033[33mYCOLOR\033[0m']
for color in colors:
print(color)
"""
)
result, html = run(testdir, "report.html", "--self-contained-html")
assert result.ret == 0
for content in pass_content:
if with_ansi:
> assert content in html
E assert '<span class="ansi31">RCOLOR' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <style>body {\n ...ut call------------------------------ <br/>RCOLOR\nGCOLOR\nYCOLOR\n<br/></div></td></tr></tbody></table></body></html>'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:926: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_ansi_color0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_ansi_color.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_ansi_color0/report.html -
============================== 1 passed in 0.01s ===============================
_______________________________________________________________________ TestHTML.test_collect_error ________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e175a00>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_collect_error0')>
def test_collect_error(self, testdir):
testdir.makepyfile(
"""
import xyz
def test_pass(): pass
"""
)
result, html = run(testdir)
assert result.ret
> assert_results(html, tests=0, passed=0, errors=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:986:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...or">E ModuleNotFoundError: No module named 'xyz'</span><br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_collect_error0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 0 items / 1 error
==================================== ERRORS ====================================
____________________ ERROR collecting test_collect_error.py ____________________
ImportError while importing test module '/tmp/pytest-of-tkloczko/pytest-259/test_collect_error0/test_collect_error.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
test_collect_error.py:1: in <module>
import xyz
E ModuleNotFoundError: No module named 'xyz'
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_collect_error0/report.html -
=========================== short test summary info ============================
ERROR test_collect_error.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.06s ===============================
______________________________________________________________________ TestHTML.test_collapsed[True] _______________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e1752b0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_collapsed0')>, is_collapsed = True
@pytest.mark.parametrize("is_collapsed", [True, False])
def test_collapsed(self, testdir, is_collapsed):
collapsed_html = '<tr class="collapsed">'
expected_count = 2 if is_collapsed else 0
testdir.makeini(
f"""
[pytest]
render_collapsed = {is_collapsed}
"""
)
testdir.makepyfile(
"""
def test_fail():
assert False
def test_pass():
assert True
"""
)
result, html = run(testdir)
assert result.ret == 1
assert len(re.findall(collapsed_html, html)) == expected_count
> assert_results(html, tests=2, passed=1, failed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:1074:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_collapsed0, configfile: tox.ini
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 2 items
test_collapsed.py F. [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
def test_fail():
> assert False
E assert False
test_collapsed.py:2: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_collapsed0/report.html -
=========================== short test summary info ============================
FAILED test_collapsed.py::test_fail - assert False
========================= 1 failed, 1 passed in 0.01s ==========================
______________________________________________________________________ TestHTML.test_collapsed[False] ______________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e175f10>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_collapsed1')>, is_collapsed = False
@pytest.mark.parametrize("is_collapsed", [True, False])
def test_collapsed(self, testdir, is_collapsed):
collapsed_html = '<tr class="collapsed">'
expected_count = 2 if is_collapsed else 0
testdir.makeini(
f"""
[pytest]
render_collapsed = {is_collapsed}
"""
)
testdir.makepyfile(
"""
def test_fail():
assert False
def test_pass():
assert True
"""
)
result, html = run(testdir)
assert result.ret == 1
assert len(re.findall(collapsed_html, html)) == expected_count
> assert_results(html, tests=2, passed=1, failed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:1074:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_collapsed1, configfile: tox.ini
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 2 items
test_collapsed.py F. [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
def test_fail():
> assert False
E assert False
test_collapsed.py:2: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_collapsed1/report.html -
=========================== short test summary info ============================
FAILED test_collapsed.py::test_fail - assert False
========================= 1 failed, 1 passed in 0.01s ==========================
_________________________________________________________________ TestHTML.test_setup_and_teardown_in_html _________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e18e460>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_setup_and_teardown_in_html0')>
def test_setup_and_teardown_in_html(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.fixture(scope="function")
def setupAndTeardown():
print ("this is setup")
yield
print ("this is teardown")
def test_setup_and_teardown(setupAndTeardown):
print ("this is the test case")
"""
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, tests=1, passed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:1108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...stdout teardown---------------------------- <br/>this is teardown\n<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_setup_and_teardown_in_html0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_setup_and_teardown_in_html.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_setup_and_teardown_in_html0/report.html -
============================== 1 passed in 0.01s ===============================
_________________________________________________________________ TestHTML.test_setup_failures_are_errors __________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e18e610>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_setup_failures_are_errors0')>
def test_setup_failures_are_errors(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.fixture(scope="function")
def setup():
assert 0, "failure!"
def test_setup(setup):
print ("this is the test case")
"""
)
result, html = run(testdir)
assert result.ret == 1
> assert_results(html, tests=0, passed=0, errors=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:1127:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset.../span><br/><br/>test_setup_failures_are_errors.py:4: AssertionError<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_setup_failures_are_errors0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_setup_failures_are_errors.py E [100%]
==================================== ERRORS ====================================
_________________________ ERROR at setup of test_setup _________________________
@pytest.fixture(scope="function")
def setup():
> assert 0, "failure!"
E AssertionError: failure!
E assert 0
test_setup_failures_are_errors.py:4: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_setup_failures_are_errors0/report.html -
=========================== short test summary info ============================
ERROR test_setup_failures_are_errors.py::test_setup - AssertionError: failure!
=============================== 1 error in 0.01s ===============================
________________________________________________________________ TestHTML.test_teardown_failures_are_errors ________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e18e7c0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_teardown_failures_are_errors0')>
def test_teardown_failures_are_errors(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.fixture(scope="function")
def teardown():
yield
assert 0, "failure!"
def test_setup(teardown):
print ("this is the test case")
"""
)
result, html = run(testdir)
assert result.ret == 1
> assert_results(html, tests=0, passed=0, errors=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:1145:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...out call------------------------------ <br/>this is the test case\n<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_teardown_failures_are_errors0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_teardown_failures_are_errors.py .E [100%]
==================================== ERRORS ====================================
_______________________ ERROR at teardown of test_setup ________________________
@pytest.fixture(scope="function")
def teardown():
yield
> assert 0, "failure!"
E AssertionError: failure!
E assert 0
test_teardown_failures_are_errors.py:5: AssertionError
----------------------------- Captured stdout call -----------------------------
this is the test case
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_teardown_failures_are_errors0/report.html -
=========================== short test summary info ============================
ERROR test_teardown_failures_are_errors.py::test_setup
========================== 1 passed, 1 error in 0.01s ==========================
_____________________________________________________ TestHTML.test_extra_log_reporting_respects_capture_no[-s-False] ______________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e18eb80>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_capture_no0')>
capture_flag = '-s', should_capture = False
@pytest.mark.parametrize(
"capture_flag, should_capture",
[("-s", False), ("--capture=no", False), ("--capture=sys", True)],
)
def test_extra_log_reporting_respects_capture_no(
self, testdir, capture_flag, should_capture
):
testdir.makepyfile(
"""
import sys
def test_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
"""
)
result, html = run(testdir, "report.html", capture_flag)
assert result.ret == 0
> assert_results(html)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:1166:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_capture_no0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_extra_log_reporting_respects_capture_no.py stdout print line
.
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_capture_no0/report.html -
============================== 1 passed in 0.01s ===============================
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
stderr print line
________________________________________________ TestHTML.test_extra_log_reporting_respects_capture_no[--capture=no-False] _________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e18ebe0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_capture_no1')>
capture_flag = '--capture=no', should_capture = False
@pytest.mark.parametrize(
"capture_flag, should_capture",
[("-s", False), ("--capture=no", False), ("--capture=sys", True)],
)
def test_extra_log_reporting_respects_capture_no(
self, testdir, capture_flag, should_capture
):
testdir.makepyfile(
"""
import sys
def test_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
"""
)
result, html = run(testdir, "report.html", capture_flag)
assert result.ret == 0
> assert_results(html)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:1166:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_capture_no1
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_extra_log_reporting_respects_capture_no.py stdout print line
.
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_capture_no1/report.html -
============================== 1 passed in 0.01s ===============================
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
stderr print line
________________________________________________ TestHTML.test_extra_log_reporting_respects_capture_no[--capture=sys-True] _________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e18ec70>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_capture_no2')>
capture_flag = '--capture=sys', should_capture = True
@pytest.mark.parametrize(
"capture_flag, should_capture",
[("-s", False), ("--capture=no", False), ("--capture=sys", True)],
)
def test_extra_log_reporting_respects_capture_no(
self, testdir, capture_flag, should_capture
):
testdir.makepyfile(
"""
import sys
def test_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
"""
)
result, html = run(testdir, "report.html", capture_flag)
assert result.ret == 0
> assert_results(html)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:1166:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset... stderr call------------------------------ <br/>stderr print line\n<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_capture_no2
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_extra_log_reporting_respects_capture_no.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_capture_no2/report.html -
============================== 1 passed in 0.01s ===============================
___________________________________________ TestHTML.test_extra_log_reporting_respects_show_capture_no[--show-capture=no-False] ____________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e18ef10>
testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_show_capture_no0')>, show_capture_flag = '--show-capture=no'
should_capture = False
@pytest.mark.parametrize(
"show_capture_flag, should_capture",
[("--show-capture=no", False), ("--show-capture=all", True)],
)
def test_extra_log_reporting_respects_show_capture_no(
self, testdir, show_capture_flag, should_capture
):
testdir.makepyfile(
"""
import sys
def test_show_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
assert False
"""
)
result, html = run(testdir, "report.html", show_capture_flag)
assert result.ret == 1
> assert_results(html, passed=0, failed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:1196:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_show_capture_no0
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_extra_log_reporting_respects_show_capture_no.py F [100%]
=================================== FAILURES ===================================
_____________________________ test_show_capture_no _____________________________
def test_show_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
> assert False
E assert False
test_extra_log_reporting_respects_show_capture_no.py:5: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_show_capture_no0/report.html -
=========================== short test summary info ============================
FAILED test_extra_log_reporting_respects_show_capture_no.py::test_show_capture_no
============================== 1 failed in 0.01s ===============================
___________________________________________ TestHTML.test_extra_log_reporting_respects_show_capture_no[--show-capture=all-True] ____________________________________________
self = <test_pytest_html.TestHTML object at 0x7f693e18efa0>
testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_show_capture_no1')>, show_capture_flag = '--show-capture=all'
should_capture = True
@pytest.mark.parametrize(
"show_capture_flag, should_capture",
[("--show-capture=no", False), ("--show-capture=all", True)],
)
def test_extra_log_reporting_respects_show_capture_no(
self, testdir, show_capture_flag, should_capture
):
testdir.makepyfile(
"""
import sys
def test_show_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
assert False
"""
)
result, html = run(testdir, "report.html", show_capture_flag)
assert result.ret == 1
> assert_results(html, passed=0, failed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:1196:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:96: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>Test Report</title>\n <link href="asset... stderr call------------------------------ <br/>stderr print line\n<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.1.1/testing/test_pytest_html.py:53: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_show_capture_no1
plugins: html-3.1.1, metadata-1.11.0, mock-3.8.1
collected 1 item
test_extra_log_reporting_respects_show_capture_no.py F [100%]
=================================== FAILURES ===================================
_____________________________ test_show_capture_no _____________________________
def test_show_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
> assert False
E assert False
test_extra_log_reporting_respects_show_capture_no.py:5: AssertionError
----------------------------- Captured stdout call -----------------------------
stdout print line
----------------------------- Captured stderr call -----------------------------
stderr print line
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-259/test_extra_log_reporting_respects_show_capture_no1/report.html -
=========================== short test summary info ============================
FAILED test_extra_log_reporting_respects_show_capture_no.py::test_show_capture_no
============================== 1 failed in 0.01s ===============================
========================================================================= short test summary info ==========================================================================
FAILED testing/test_pytest_html.py::TestHTML::test_durations - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_can_format_duration_column[%f-<td class="col-duration">\\d{2}</td>] - AttributeError: 'NoneType' object has no attribu...
FAILED testing/test_pytest_html.py::TestHTML::test_can_format_duration_column[%S.%f-<td class="col-duration">\\d{2}\\.\\d{2}</td>] - AttributeError: 'NoneType' object ha...
FAILED testing/test_pytest_html.py::TestHTML::test_can_format_duration_column[ABC%H %M %S123-<td class="col-duration">ABC\\d{2} \\d{2} \\d{2}123</td>] - AttributeError...
FAILED testing/test_pytest_html.py::TestHTML::test_pass - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_skip - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_fail - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_rerun - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_conditional_xfails - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_setup_error - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_xfail - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_xpass - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_create_report_path - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_extra_image_separated_rerun[png-image] - assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__te...
FAILED testing/test_pytest_html.py::TestHTML::test_extra_image_separated_rerun[png-png] - assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test...
FAILED testing/test_pytest_html.py::TestHTML::test_extra_image_separated_rerun[svg-svg] - assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test...
FAILED testing/test_pytest_html.py::TestHTML::test_extra_image_separated_rerun[jpg-jpg] - assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test...
FAILED testing/test_pytest_html.py::TestHTML::test_environment_xdist - FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-259/test_e...
FAILED testing/test_pytest_html.py::TestHTML::test_environment_xdist_reruns - FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-259...
FAILED testing/test_pytest_html.py::TestHTML::test_xdist_crashing_worker - FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-259/te...
FAILED testing/test_pytest_html.py::TestHTML::test_utf8_surrogate - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_ansi_color[True] - assert '<span class="ansi31">RCOLOR' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-...
FAILED testing/test_pytest_html.py::TestHTML::test_collect_error - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_collapsed[True] - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_collapsed[False] - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_setup_and_teardown_in_html - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_setup_failures_are_errors - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_teardown_failures_are_errors - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_extra_log_reporting_respects_capture_no[-s-False] - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_extra_log_reporting_respects_capture_no[--capture=no-False] - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_extra_log_reporting_respects_capture_no[--capture=sys-True] - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_extra_log_reporting_respects_show_capture_no[--show-capture=no-False] - AttributeError: 'NoneType' object has no attri...
FAILED testing/test_pytest_html.py::TestHTML::test_extra_log_reporting_respects_show_capture_no[--show-capture=all-True] - AttributeError: 'NoneType' object has no attri...
====================================================================== 33 failed, 56 passed in 10.14s ======================================================================
Could you try with this branch: https://github.com/BeyondEvil/pytest-html/tree/combined-fe-and-be ?
Also, any idea why it's failing?
In that repo there a re much more vesion tags than here. If you have any fix fot that issue pleae open PR here and I'll be glad to test it.
Just tested 3.2.0 and pytest still is failing
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-html-3.2.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-html-3.2.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0, configfile: tox.ini, testpaths: testing
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 87 items
testing/test_pytest_html.py FFFFFFFF.FFFFF.............................FFFF.........FF......FFF....F....FFFFFFFFFFF [100%]
================================================================================= FAILURES =================================================================================
_________________________________________________________________________ TestHTML.test_durations __________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24a28e0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_durations0')>
def test_durations(self, testdir):
sleep = float(0.2)
testdir.makepyfile(
"""
import time
def test_sleep():
time.sleep({:f})
""".format(
sleep * 2
)
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, duration=sleep)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_durations0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_durations.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_durations0/report.html -
============================== 1 passed in 0.42s ===============================
____________________________________________ TestHTML.test_can_format_duration_column[%f-<td class="col-duration">\\d{2}</td>] _____________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24c2220>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_can_format_duration_column0')>
duration_formatter = '%f', expected_report_content = '<td class="col-duration">\\d{2}</td>'
@pytest.mark.parametrize(
"duration_formatter,expected_report_content",
[
("%f", r'<td class="col-duration">\d{2}</td>'),
("%S.%f", r'<td class="col-duration">\d{2}\.\d{2}</td>'),
(
"ABC%H %M %S123",
r'<td class="col-duration">ABC\d{2} \d{2} \d{2}123</td>',
),
],
)
def test_can_format_duration_column(
self, testdir, duration_formatter, expected_report_content
):
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
setattr(report, "duration_formatter", "{duration_formatter}")
"""
)
sleep = float(0.2)
testdir.makepyfile(
"""
import time
def test_sleep():
time.sleep({:f})
""".format(
sleep
)
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, duration=sleep)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:135:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_can_format_duration_column0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_can_format_duration_column.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_can_format_duration_column0/report.html -
============================== 1 passed in 0.22s ===============================
______________________________________ TestHTML.test_can_format_duration_column[%S.%f-<td class="col-duration">\\d{2}\\.\\d{2}</td>] _______________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24c2610>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_can_format_duration_column1')>
duration_formatter = '%S.%f', expected_report_content = '<td class="col-duration">\\d{2}\\.\\d{2}</td>'
@pytest.mark.parametrize(
"duration_formatter,expected_report_content",
[
("%f", r'<td class="col-duration">\d{2}</td>'),
("%S.%f", r'<td class="col-duration">\d{2}\.\d{2}</td>'),
(
"ABC%H %M %S123",
r'<td class="col-duration">ABC\d{2} \d{2} \d{2}123</td>',
),
],
)
def test_can_format_duration_column(
self, testdir, duration_formatter, expected_report_content
):
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
setattr(report, "duration_formatter", "{duration_formatter}")
"""
)
sleep = float(0.2)
testdir.makepyfile(
"""
import time
def test_sleep():
time.sleep({:f})
""".format(
sleep
)
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, duration=sleep)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:135:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_can_format_duration_column1
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_can_format_duration_column.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_can_format_duration_column1/report.html -
============================== 1 passed in 0.22s ===============================
___________________________ TestHTML.test_can_format_duration_column[ABC%H %M %S123-<td class="col-duration">ABC\\d{2} \\d{2} \\d{2}123</td>] ____________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24c2be0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_can_format_duration_column2')>
duration_formatter = 'ABC%H %M %S123', expected_report_content = '<td class="col-duration">ABC\\d{2} \\d{2} \\d{2}123</td>'
@pytest.mark.parametrize(
"duration_formatter,expected_report_content",
[
("%f", r'<td class="col-duration">\d{2}</td>'),
("%S.%f", r'<td class="col-duration">\d{2}\.\d{2}</td>'),
(
"ABC%H %M %S123",
r'<td class="col-duration">ABC\d{2} \d{2} \d{2}123</td>',
),
],
)
def test_can_format_duration_column(
self, testdir, duration_formatter, expected_report_content
):
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
setattr(report, "duration_formatter", "{duration_formatter}")
"""
)
sleep = float(0.2)
testdir.makepyfile(
"""
import time
def test_sleep():
time.sleep({:f})
""".format(
sleep
)
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, duration=sleep)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:135:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_can_format_duration_column2
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_can_format_duration_column.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_can_format_duration_column2/report.html -
============================== 1 passed in 0.21s ===============================
____________________________________________________________________________ TestHTML.test_pass ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24c2c70>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_pass0')>
def test_pass(self, testdir):
testdir.makepyfile("def test_pass(): pass")
result, html = run(testdir)
assert result.ret == 0
> assert_results(html)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:144:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_pass0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_pass.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_pass0/report.html -
============================== 1 passed in 0.01s ===============================
____________________________________________________________________________ TestHTML.test_skip ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24c2370>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_skip0')>
def test_skip(self, testdir):
reason = str(random.random())
testdir.makepyfile(
f"""
import pytest
def test_skip():
pytest.skip('{reason}')
"""
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, tests=0, passed=0, skipped=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:157:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...p0/test_skip.py', 3, 'Skipped: 0.13249890835464562')<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_skip0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_skip.py s [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_skip0/report.html -
============================== 1 skipped in 0.01s ==============================
____________________________________________________________________________ TestHTML.test_fail ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24c2430>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_fail0')>
def test_fail(self, testdir):
testdir.makepyfile("def test_fail(): assert False")
result, html = run(testdir)
assert result.ret
> assert_results(html, passed=0, failed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...or">E assert False</span><br/><br/>test_fail.py:1: AssertionError<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_fail0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_fail.py F [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
> def test_fail(): assert False
E assert False
test_fail.py:1: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_fail0/report.html -
=========================== short test summary info ============================
FAILED test_fail.py::test_fail - assert False
============================== 1 failed in 0.01s ===============================
___________________________________________________________________________ TestHTML.test_rerun ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24c2e80>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_rerun0')>
@pytest.mark.skipif(sys.platform == "win32", reason="Test is flaky on Windows")
def test_rerun(self, testdir):
testdir.makeconftest(
"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
pytest_html = item.config.pluginmanager.getplugin("html")
outcome = yield
report = outcome.get_result()
extra = getattr(report, "extra", [])
if report.when == "call":
extra.append(pytest_html.extras.url("http://www.example.com/"))
report.extra = extra
"""
)
testdir.makepyfile(
"""
import pytest
import time
@pytest.mark.flaky(reruns=2)
def test_example():
time.sleep(1)
assert False
"""
)
result, html = run(testdir)
assert result.ret
> assert_results(html, passed=0, failed=1, rerun=2)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:200:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset... assert False</span><br/><br/>test_rerun.py:7: AssertionError<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 2, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_rerun0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_rerun.py F [100%]
=================================== FAILURES ===================================
_________________________________ test_example _________________________________
@pytest.mark.flaky(reruns=2)
def test_example():
time.sleep(1)
> assert False
E assert False
test_rerun.py:7: AssertionError
=============================== warnings summary ===============================
test_rerun.py:4
/tmp/pytest-of-tkloczko/pytest-60/test_rerun0/test_rerun.py:4: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.flaky(reruns=2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_rerun0/report.html -
=========================== short test summary info ============================
FAILED test_rerun.py::test_example - assert False
========================= 1 failed, 1 warning in 1.03s =========================
_____________________________________________________________________ TestHTML.test_conditional_xfails _____________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24b94f0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_conditional_xfails0')>
def test_conditional_xfails(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.mark.xfail(False, reason='reason')
def test_fail(): assert False
@pytest.mark.xfail(False, reason='reason')
def test_pass(): pass
@pytest.mark.xfail(True, reason='reason')
def test_xfail(): assert False
@pytest.mark.xfail(True, reason='reason')
def test_xpass(): pass
"""
)
result, html = run(testdir)
assert result.ret
> assert_results(html, tests=4, passed=1, failed=1, xfailed=1, xpassed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:233:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_conditional_xfails0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 4 items
test_conditional_xfails.py F.xX [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
@pytest.mark.xfail(False, reason='reason')
> def test_fail(): assert False
E assert False
test_conditional_xfails.py:3: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_conditional_xfails0/report.html -
=========================== short test summary info ============================
FAILED test_conditional_xfails.py::test_fail - assert False
============== 1 failed, 1 passed, 1 xfailed, 1 xpassed in 0.02s ===============
________________________________________________________________________ TestHTML.test_setup_error _________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24b9460>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_setup_error0')>
def test_setup_error(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.fixture
def arg(request):
raise ValueError()
def test_function(arg):
pass
"""
)
result, html = run(testdir)
assert result.ret
> assert_results(html, tests=0, passed=0, errors=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:248:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset... ValueError</span><br/><br/>test_setup_error.py:4: ValueError<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_setup_error0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_setup_error.py E [100%]
==================================== ERRORS ====================================
_______________________ ERROR at setup of test_function ________________________
request = <SubRequest 'arg' for <Function test_function>>
@pytest.fixture
def arg(request):
> raise ValueError()
E ValueError
test_setup_error.py:4: ValueError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_setup_error0/report.html -
=========================== short test summary info ============================
ERROR test_setup_error.py::test_function - ValueError
=============================== 1 error in 0.01s ===============================
___________________________________________________________________________ TestHTML.test_xfail ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24b9fd0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_xfail0')>
def test_xfail(self, testdir):
reason = str(random.random())
testdir.makepyfile(
f"""
import pytest
def test_xfail():
pytest.xfail('{reason}')
"""
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, passed=0, xfailed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:263:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...Failed: 0.9465023101697781</span><br/><br/>test_xfail.py:3: XFailed<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_xfail0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_xfail.py x [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_xfail0/report.html -
============================== 1 xfailed in 0.01s ==============================
___________________________________________________________________________ TestHTML.test_xpass ____________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24b9880>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_xpass0')>
def test_xpass(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.mark.xfail()
def test_xpass():
pass
"""
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, passed=0, xpassed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:277:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_xpass0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_xpass.py X [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_xpass0/report.html -
============================== 1 xpassed in 0.01s ==============================
_____________________________________________________________________ TestHTML.test_create_report_path _____________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24c4e50>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_create_report_path0')>
def test_create_report_path(self, testdir):
testdir.makepyfile("def test_pass(): pass")
path = os.path.join("directory", "report.html")
result, html = run(testdir, path)
assert result.ret == 0
> assert_results(html)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:284:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_create_report_path0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_create_report_path.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_create_report_path0/directory/report.html -
============================== 1 passed in 0.01s ===============================
___________________________________________________________ TestHTML.test_extra_image_separated_rerun[png-image] ___________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24b4430>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun0')>
file_extension = 'png', extra_type = 'image'
@pytest.mark.parametrize(
"file_extension, extra_type",
[("png", "image"), ("png", "png"), ("svg", "svg"), ("jpg", "jpg")],
)
def test_extra_image_separated_rerun(self, testdir, file_extension, extra_type):
content = b64encode(b"foo").decode("ascii")
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
if report.when == 'call':
from pytest_html import extras
report.extra = [extras.{extra_type}('{content}')]
"""
)
testdir.makepyfile(
"""
import pytest
@pytest.mark.flaky(reruns=2)
def test_fail():
assert False"""
)
result, html = run(testdir)
for i in range(1, 4):
asset_name = "test_extra_image_separated_rerun.py__test_fail"
src = f"assets/{asset_name}_0_{i}.{file_extension}"
link = f'<a class="image" href="{src}" target="_blank">'
img = f'<img src="{src}"/>'
assert result.ret
> assert link in html
E assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test_fail_0_1.png" target="_blank">' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...pan><br/><br/>test_extra_image_separated_rerun.py:4: AssertionError<br/></div></td></tr></tbody></table></body></html>'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:629: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_extra_image_separated_rerun.py F [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
@pytest.mark.flaky(reruns=2)
def test_fail():
> assert False
E assert False
test_extra_image_separated_rerun.py:4: AssertionError
=============================== warnings summary ===============================
test_extra_image_separated_rerun.py:2
/tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun0/test_extra_image_separated_rerun.py:2: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.flaky(reruns=2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun0/report.html -
=========================== short test summary info ============================
FAILED test_extra_image_separated_rerun.py::test_fail - assert False
========================= 1 failed, 1 warning in 0.01s =========================
____________________________________________________________ TestHTML.test_extra_image_separated_rerun[png-png] ____________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24b44c0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun1')>
file_extension = 'png', extra_type = 'png'
@pytest.mark.parametrize(
"file_extension, extra_type",
[("png", "image"), ("png", "png"), ("svg", "svg"), ("jpg", "jpg")],
)
def test_extra_image_separated_rerun(self, testdir, file_extension, extra_type):
content = b64encode(b"foo").decode("ascii")
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
if report.when == 'call':
from pytest_html import extras
report.extra = [extras.{extra_type}('{content}')]
"""
)
testdir.makepyfile(
"""
import pytest
@pytest.mark.flaky(reruns=2)
def test_fail():
assert False"""
)
result, html = run(testdir)
for i in range(1, 4):
asset_name = "test_extra_image_separated_rerun.py__test_fail"
src = f"assets/{asset_name}_0_{i}.{file_extension}"
link = f'<a class="image" href="{src}" target="_blank">'
img = f'<img src="{src}"/>'
assert result.ret
> assert link in html
E assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test_fail_0_1.png" target="_blank">' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...pan><br/><br/>test_extra_image_separated_rerun.py:4: AssertionError<br/></div></td></tr></tbody></table></body></html>'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:629: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun1
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_extra_image_separated_rerun.py F [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
@pytest.mark.flaky(reruns=2)
def test_fail():
> assert False
E assert False
test_extra_image_separated_rerun.py:4: AssertionError
=============================== warnings summary ===============================
test_extra_image_separated_rerun.py:2
/tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun1/test_extra_image_separated_rerun.py:2: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.flaky(reruns=2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun1/report.html -
=========================== short test summary info ============================
FAILED test_extra_image_separated_rerun.py::test_fail - assert False
========================= 1 failed, 1 warning in 0.01s =========================
____________________________________________________________ TestHTML.test_extra_image_separated_rerun[svg-svg] ____________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24b49a0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun2')>
file_extension = 'svg', extra_type = 'svg'
@pytest.mark.parametrize(
"file_extension, extra_type",
[("png", "image"), ("png", "png"), ("svg", "svg"), ("jpg", "jpg")],
)
def test_extra_image_separated_rerun(self, testdir, file_extension, extra_type):
content = b64encode(b"foo").decode("ascii")
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
if report.when == 'call':
from pytest_html import extras
report.extra = [extras.{extra_type}('{content}')]
"""
)
testdir.makepyfile(
"""
import pytest
@pytest.mark.flaky(reruns=2)
def test_fail():
assert False"""
)
result, html = run(testdir)
for i in range(1, 4):
asset_name = "test_extra_image_separated_rerun.py__test_fail"
src = f"assets/{asset_name}_0_{i}.{file_extension}"
link = f'<a class="image" href="{src}" target="_blank">'
img = f'<img src="{src}"/>'
assert result.ret
> assert link in html
E assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test_fail_0_1.svg" target="_blank">' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...pan><br/><br/>test_extra_image_separated_rerun.py:4: AssertionError<br/></div></td></tr></tbody></table></body></html>'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:629: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun2
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_extra_image_separated_rerun.py F [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
@pytest.mark.flaky(reruns=2)
def test_fail():
> assert False
E assert False
test_extra_image_separated_rerun.py:4: AssertionError
=============================== warnings summary ===============================
test_extra_image_separated_rerun.py:2
/tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun2/test_extra_image_separated_rerun.py:2: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.flaky(reruns=2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun2/report.html -
=========================== short test summary info ============================
FAILED test_extra_image_separated_rerun.py::test_fail - assert False
========================= 1 failed, 1 warning in 0.01s =========================
____________________________________________________________ TestHTML.test_extra_image_separated_rerun[jpg-jpg] ____________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24b4c70>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun3')>
file_extension = 'jpg', extra_type = 'jpg'
@pytest.mark.parametrize(
"file_extension, extra_type",
[("png", "image"), ("png", "png"), ("svg", "svg"), ("jpg", "jpg")],
)
def test_extra_image_separated_rerun(self, testdir, file_extension, extra_type):
content = b64encode(b"foo").decode("ascii")
testdir.makeconftest(
f"""
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
if report.when == 'call':
from pytest_html import extras
report.extra = [extras.{extra_type}('{content}')]
"""
)
testdir.makepyfile(
"""
import pytest
@pytest.mark.flaky(reruns=2)
def test_fail():
assert False"""
)
result, html = run(testdir)
for i in range(1, 4):
asset_name = "test_extra_image_separated_rerun.py__test_fail"
src = f"assets/{asset_name}_0_{i}.{file_extension}"
link = f'<a class="image" href="{src}" target="_blank">'
img = f'<img src="{src}"/>'
assert result.ret
> assert link in html
E assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test_fail_0_1.jpg" target="_blank">' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...pan><br/><br/>test_extra_image_separated_rerun.py:4: AssertionError<br/></div></td></tr></tbody></table></body></html>'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:629: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun3
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_extra_image_separated_rerun.py F [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
@pytest.mark.flaky(reruns=2)
def test_fail():
> assert False
E assert False
test_extra_image_separated_rerun.py:4: AssertionError
=============================== warnings summary ===============================
test_extra_image_separated_rerun.py:2
/tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun3/test_extra_image_separated_rerun.py:2: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.flaky(reruns=2)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_extra_image_separated_rerun3/report.html -
=========================== short test summary info ============================
FAILED test_extra_image_separated_rerun.py::test_fail - assert False
========================= 1 failed, 1 warning in 0.01s =========================
_____________________________________________________________________ TestHTML.test_environment_xdist ______________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24bf9a0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_environment_xdist0')>
def test_environment_xdist(self, testdir):
content = str(random.random())
testdir.makeconftest(
f"""
def pytest_configure(config):
for i in range(2):
config._metadata['content'] = '{content}'
"""
)
testdir.makepyfile("def test_pass(): pass")
> result, html = run(testdir, "report.html", "-n", "1")
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:768:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:20: in run
return result, read_html(path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = local('/tmp/pytest-of-tkloczko/pytest-60/test_environment_xdist0/report.html')
def read_html(path):
> with open(str(path)) as f:
E FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-60/test_environment_xdist0/report.html'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:24: FileNotFoundError
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n
inifile: None
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_environment_xdist0
__________________________________________________________________ TestHTML.test_environment_xdist_reruns __________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24b4220>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_environment_xdist_reruns0')>
def test_environment_xdist_reruns(self, testdir):
content = str(random.random())
testdir.makeconftest(
f"""
def pytest_configure(config):
for i in range(2):
config._metadata['content'] = '{content}'
"""
)
testdir.makepyfile("def test_fail(): assert False")
> result, html = run(testdir, "report.html", "-n", "1", "--reruns", "1")
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:783:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:20: in run
return result, read_html(path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = local('/tmp/pytest-of-tkloczko/pytest-60/test_environment_xdist_reruns0/report.html')
def read_html(path):
> with open(str(path)) as f:
E FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-60/test_environment_xdist_reruns0/report.html'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:24: FileNotFoundError
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n --reruns 1
inifile: None
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_environment_xdist_reruns0
___________________________________________________________________ TestHTML.test_xdist_crashing_worker ____________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24a82b0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_xdist_crashing_worker0')>
def test_xdist_crashing_worker(self, testdir):
"""https://github.com/pytest-dev/pytest-html/issues/21"""
testdir.makepyfile(
"""
import os
def test_exit():
os._exit(0)
"""
)
> result, html = run(testdir, "report.html", "-n", "1")
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:881:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:20: in run
return result, read_html(path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = local('/tmp/pytest-of-tkloczko/pytest-60/test_xdist_crashing_worker0/report.html')
def read_html(path):
> with open(str(path)) as f:
E FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-60/test_xdist_crashing_worker0/report.html'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:24: FileNotFoundError
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n
inifile: None
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_xdist_crashing_worker0
_______________________________________________________________________ TestHTML.test_utf8_surrogate _______________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24a88b0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_utf8_surrogate0')>
def test_utf8_surrogate(self, testdir):
testdir.makepyfile(
r"""
import pytest
@pytest.mark.parametrize('val', ['\ud800'])
def test_foo(val):
pass
"""
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, passed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:896:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_utf8_surrogate0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_utf8_surrogate.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_utf8_surrogate0/report.html -
============================== 1 passed in 0.01s ===============================
______________________________________________________________________ TestHTML.test_ansi_color[True] ______________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24060d0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_ansi_color0')>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f3cf1f805e0>, with_ansi = True
@pytest.mark.parametrize(
"with_ansi",
[True, False],
)
def test_ansi_color(self, testdir, mocker, with_ansi):
if not with_ansi:
mock_ansi_support = mocker.patch("pytest_html.html_report.ansi_support")
mock_ansi_support = mocker.patch("pytest_html.result.ansi_support")
mock_ansi_support.return_value = None
pass_content = [
'<span class="ansi31">RCOLOR',
'<span class="ansi32">GCOLOR',
'<span class="ansi33">YCOLOR',
]
testdir.makepyfile(
r"""
def test_ansi():
colors = ['\033[31mRCOLOR\033[0m', '\033[32mGCOLOR\033[0m',
'\033[33mYCOLOR\033[0m']
for color in colors:
print(color)
"""
)
result, html = run(testdir, "report.html", "--self-contained-html")
assert result.ret == 0
for content in pass_content:
if with_ansi:
> assert content in html
E assert '<span class="ansi31">RCOLOR' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <style>body {\n ...ut call------------------------------ <br/>RCOLOR\nGCOLOR\nYCOLOR\n<br/></div></td></tr></tbody></table></body></html>'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:926: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_ansi_color0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_ansi_color.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_ansi_color0/report.html -
============================== 1 passed in 0.01s ===============================
_______________________________________________________________________ TestHTML.test_collect_error ________________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf2406670>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_collect_error0')>
def test_collect_error(self, testdir):
testdir.makepyfile(
"""
import xyz
def test_pass(): pass
"""
)
result, html = run(testdir)
assert result.ret
> assert_results(html, tests=0, passed=0, errors=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:986:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...or">E ModuleNotFoundError: No module named 'xyz'</span><br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_collect_error0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 0 items / 1 error
==================================== ERRORS ====================================
____________________ ERROR collecting test_collect_error.py ____________________
ImportError while importing test module '/tmp/pytest-of-tkloczko/pytest-60/test_collect_error0/test_collect_error.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
test_collect_error.py:1: in <module>
import xyz
E ModuleNotFoundError: No module named 'xyz'
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_collect_error0/report.html -
=========================== short test summary info ============================
ERROR test_collect_error.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.06s ===============================
______________________________________________________________________ TestHTML.test_collapsed[True] _______________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24a8eb0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_collapsed0')>, is_collapsed = True
@pytest.mark.parametrize("is_collapsed", [True, False])
def test_collapsed(self, testdir, is_collapsed):
collapsed_html = '<tr class="collapsed">'
expected_count = 2 if is_collapsed else 0
testdir.makeini(
f"""
[pytest]
render_collapsed = {is_collapsed}
"""
)
testdir.makepyfile(
"""
def test_fail():
assert False
def test_pass():
assert True
"""
)
result, html = run(testdir)
assert result.ret == 1
assert len(re.findall(collapsed_html, html)) == expected_count
> assert_results(html, tests=2, passed=1, failed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:1072:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_collapsed0, configfile: tox.ini
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 2 items
test_collapsed.py F. [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
def test_fail():
> assert False
E assert False
test_collapsed.py:2: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_collapsed0/report.html -
=========================== short test summary info ============================
FAILED test_collapsed.py::test_fail - assert False
========================= 1 failed, 1 passed in 0.01s ==========================
______________________________________________________________________ TestHTML.test_collapsed[False] ______________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf24bfc70>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_collapsed1')>, is_collapsed = False
@pytest.mark.parametrize("is_collapsed", [True, False])
def test_collapsed(self, testdir, is_collapsed):
collapsed_html = '<tr class="collapsed">'
expected_count = 2 if is_collapsed else 0
testdir.makeini(
f"""
[pytest]
render_collapsed = {is_collapsed}
"""
)
testdir.makepyfile(
"""
def test_fail():
assert False
def test_pass():
assert True
"""
)
result, html = run(testdir)
assert result.ret == 1
assert len(re.findall(collapsed_html, html)) == expected_count
> assert_results(html, tests=2, passed=1, failed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:1072:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_collapsed1, configfile: tox.ini
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 2 items
test_collapsed.py F. [100%]
=================================== FAILURES ===================================
__________________________________ test_fail ___________________________________
def test_fail():
> assert False
E assert False
test_collapsed.py:2: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_collapsed1/report.html -
=========================== short test summary info ============================
FAILED test_collapsed.py::test_fail - assert False
========================= 1 failed, 1 passed in 0.01s ==========================
_________________________________________________________________ TestHTML.test_setup_and_teardown_in_html _________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf2406df0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_setup_and_teardown_in_html0')>
def test_setup_and_teardown_in_html(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.fixture(scope="function")
def setupAndTeardown():
print ("this is setup")
yield
print ("this is teardown")
def test_setup_and_teardown(setupAndTeardown):
print ("this is the test case")
"""
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html, tests=1, passed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:1090:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...stdout teardown---------------------------- <br/>this is teardown\n<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_setup_and_teardown_in_html0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_setup_and_teardown_in_html.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_setup_and_teardown_in_html0/report.html -
============================== 1 passed in 0.01s ===============================
_________________________________________________________________ TestHTML.test_setup_failures_are_errors __________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf2406490>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_setup_failures_are_errors0')>
def test_setup_failures_are_errors(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.fixture(scope="function")
def setup():
assert 0, "failure!"
def test_setup(setup):
print ("this is the test case")
"""
)
result, html = run(testdir)
assert result.ret == 1
> assert_results(html, tests=0, passed=0, errors=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:1109:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset.../span><br/><br/>test_setup_failures_are_errors.py:4: AssertionError<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_setup_failures_are_errors0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_setup_failures_are_errors.py E [100%]
==================================== ERRORS ====================================
_________________________ ERROR at setup of test_setup _________________________
@pytest.fixture(scope="function")
def setup():
> assert 0, "failure!"
E AssertionError: failure!
E assert 0
test_setup_failures_are_errors.py:4: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_setup_failures_are_errors0/report.html -
=========================== short test summary info ============================
ERROR test_setup_failures_are_errors.py::test_setup - AssertionError: failure!
=============================== 1 error in 0.01s ===============================
________________________________________________________________ TestHTML.test_teardown_failures_are_errors ________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf2406fa0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_teardown_failures_are_errors0')>
def test_teardown_failures_are_errors(self, testdir):
testdir.makepyfile(
"""
import pytest
@pytest.fixture(scope="function")
def teardown():
yield
assert 0, "failure!"
def test_setup(teardown):
print ("this is the test case")
"""
)
result, html = run(testdir)
assert result.ret == 1
> assert_results(html, tests=0, passed=0, errors=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:1127:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...out call------------------------------ <br/>this is the test case\n<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_teardown_failures_are_errors0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_teardown_failures_are_errors.py .E [100%]
==================================== ERRORS ====================================
_______________________ ERROR at teardown of test_setup ________________________
@pytest.fixture(scope="function")
def teardown():
yield
> assert 0, "failure!"
E AssertionError: failure!
E assert 0
test_teardown_failures_are_errors.py:5: AssertionError
----------------------------- Captured stdout call -----------------------------
this is the test case
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_teardown_failures_are_errors0/report.html -
=========================== short test summary info ============================
ERROR test_teardown_failures_are_errors.py::test_setup
========================== 1 passed, 1 error in 0.01s ==========================
_____________________________________________________ TestHTML.test_extra_log_reporting_respects_capture_no[-s-False] ______________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf25003a0>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_capture_no0')>
capture_flag = '-s', should_capture = False
@pytest.mark.parametrize(
"capture_flag, should_capture",
[("-s", False), ("--capture=no", False), ("--capture=sys", True)],
)
def test_extra_log_reporting_respects_capture_no(
self, testdir, capture_flag, should_capture
):
testdir.makepyfile(
"""
import sys
def test_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
"""
)
result, html = run(testdir, "report.html", capture_flag)
assert result.ret == 0
> assert_results(html)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:1148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_capture_no0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_extra_log_reporting_respects_capture_no.py stdout print line
.
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_capture_no0/report.html -
============================== 1 passed in 0.01s ===============================
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
stderr print line
________________________________________________ TestHTML.test_extra_log_reporting_respects_capture_no[--capture=no-False] _________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf2500400>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_capture_no1')>
capture_flag = '--capture=no', should_capture = False
@pytest.mark.parametrize(
"capture_flag, should_capture",
[("-s", False), ("--capture=no", False), ("--capture=sys", True)],
)
def test_extra_log_reporting_respects_capture_no(
self, testdir, capture_flag, should_capture
):
testdir.makepyfile(
"""
import sys
def test_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
"""
)
result, html = run(testdir, "report.html", capture_flag)
assert result.ret == 0
> assert_results(html)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:1148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_capture_no1
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_extra_log_reporting_respects_capture_no.py stdout print line
.
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_capture_no1/report.html -
============================== 1 passed in 0.01s ===============================
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
stderr print line
________________________________________________ TestHTML.test_extra_log_reporting_respects_capture_no[--capture=sys-True] _________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf2500490>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_capture_no2')>
capture_flag = '--capture=sys', should_capture = True
@pytest.mark.parametrize(
"capture_flag, should_capture",
[("-s", False), ("--capture=no", False), ("--capture=sys", True)],
)
def test_extra_log_reporting_respects_capture_no(
self, testdir, capture_flag, should_capture
):
testdir.makepyfile(
"""
import sys
def test_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
"""
)
result, html = run(testdir, "report.html", capture_flag)
assert result.ret == 0
> assert_results(html)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:1148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset... stderr call------------------------------ <br/>stderr print line\n<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_capture_no2
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_extra_log_reporting_respects_capture_no.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_capture_no2/report.html -
============================== 1 passed in 0.01s ===============================
___________________________________________ TestHTML.test_extra_log_reporting_respects_show_capture_no[--show-capture=no-False] ____________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf2500730>
testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_show_capture_no0')>, show_capture_flag = '--show-capture=no'
should_capture = False
@pytest.mark.parametrize(
"show_capture_flag, should_capture",
[("--show-capture=no", False), ("--show-capture=all", True)],
)
def test_extra_log_reporting_respects_show_capture_no(
self, testdir, show_capture_flag, should_capture
):
testdir.makepyfile(
"""
import sys
def test_show_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
assert False
"""
)
result, html = run(testdir, "report.html", show_capture_flag)
assert result.ret == 1
> assert_results(html, passed=0, failed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:1178:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_show_capture_no0
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_extra_log_reporting_respects_show_capture_no.py F [100%]
=================================== FAILURES ===================================
_____________________________ test_show_capture_no _____________________________
def test_show_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
> assert False
E assert False
test_extra_log_reporting_respects_show_capture_no.py:5: AssertionError
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_show_capture_no0/report.html -
=========================== short test summary info ============================
FAILED test_extra_log_reporting_respects_show_capture_no.py::test_show_capture_no
============================== 1 failed in 0.01s ===============================
___________________________________________ TestHTML.test_extra_log_reporting_respects_show_capture_no[--show-capture=all-True] ____________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf25007c0>
testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_show_capture_no1')>, show_capture_flag = '--show-capture=all'
should_capture = True
@pytest.mark.parametrize(
"show_capture_flag, should_capture",
[("--show-capture=no", False), ("--show-capture=all", True)],
)
def test_extra_log_reporting_respects_show_capture_no(
self, testdir, show_capture_flag, should_capture
):
testdir.makepyfile(
"""
import sys
def test_show_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
assert False
"""
)
result, html = run(testdir, "report.html", show_capture_flag)
assert result.ret == 1
> assert_results(html, passed=0, failed=1)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:1178:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset... stderr call------------------------------ <br/>stderr print line\n<br/></div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_show_capture_no1
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_extra_log_reporting_respects_show_capture_no.py F [100%]
=================================== FAILURES ===================================
_____________________________ test_show_capture_no _____________________________
def test_show_capture_no():
print("stdout print line")
print("stderr print line", file=sys.stderr)
> assert False
E assert False
test_extra_log_reporting_respects_show_capture_no.py:5: AssertionError
----------------------------- Captured stdout call -----------------------------
stdout print line
----------------------------- Captured stderr call -----------------------------
stderr print line
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_extra_log_reporting_respects_show_capture_no1/report.html -
=========================== short test summary info ============================
FAILED test_extra_log_reporting_respects_show_capture_no.py::test_show_capture_no
============================== 1 failed in 0.01s ===============================
_______________________________________________________________ TestHTML.test_environment_table_redact_list ________________________________________________________________
self = <test_pytest_html.TestHTML object at 0x7f3cf2500850>, testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-60/test_environment_table_redact_list0')>
def test_environment_table_redact_list(self, testdir):
testdir.makeini(
"""
[pytest]
environment_table_redact_list = ^foo$
.*redact.*
bar
"""
)
testdir.makeconftest(
"""
def pytest_configure(config):
config._metadata["foo"] = "will not appear a"
config._metadata["afoo"] = "will appear"
config._metadata["foos"] = "will appear"
config._metadata["redact"] = "will not appear ab"
config._metadata["will_redact"] = "will not appear abc"
config._metadata["redacted_item"] = "will not appear abcd"
config._metadata["unrelated_item"] = "will appear"
config._metadata["bar"] = "will not appear abcde"
config._metadata["bars"] = "will not appear abcdef"
"""
)
testdir.makepyfile(
"""
def test_pass():
assert True
"""
)
result, html = run(testdir)
assert result.ret == 0
> assert_results(html)
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:1223:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:74: in assert_results
assert_results_by_outcome(html, "rerun", rerun)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8"/>\n <title>report.html</title>\n <link href="asset...colspan="4">\n <div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>'
test_outcome = 'rerun', test_outcome_number = 0, label = None
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
# Asserts if the test number of this outcome in the summary is correct
regex_summary = r"(\d)+ {}".format(label or test_outcome)
> assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
E AttributeError: 'NoneType' object has no attribute 'group'
/home/tkloczko/rpmbuild/BUILD/pytest-html-3.2.0/testing/test_pytest_html.py:31: AttributeError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-60/test_environment_table_redact_list0, configfile: tox.ini
plugins: html-3.2.0, metadata-1.11.0, mock-3.10.0
collected 1 item
test_environment_table_redact_list.py . [100%]
- generated html file: file:///tmp/pytest-of-tkloczko/pytest-60/test_environment_table_redact_list0/report.html -
============================== 1 passed in 0.01s ===============================
========================================================================= short test summary info ==========================================================================
FAILED testing/test_pytest_html.py::TestHTML::test_durations - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_can_format_duration_column[%f-<td class="col-duration">\\d{2}</td>] - AttributeError: 'NoneType' object has no attribu...
FAILED testing/test_pytest_html.py::TestHTML::test_can_format_duration_column[%S.%f-<td class="col-duration">\\d{2}\\.\\d{2}</td>] - AttributeError: 'NoneType' object ha...
FAILED testing/test_pytest_html.py::TestHTML::test_can_format_duration_column[ABC%H %M %S123-<td class="col-duration">ABC\\d{2} \\d{2} \\d{2}123</td>] - AttributeError...
FAILED testing/test_pytest_html.py::TestHTML::test_pass - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_skip - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_fail - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_rerun - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_conditional_xfails - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_setup_error - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_xfail - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_xpass - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_create_report_path - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_extra_image_separated_rerun[png-image] - assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__te...
FAILED testing/test_pytest_html.py::TestHTML::test_extra_image_separated_rerun[png-png] - assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test...
FAILED testing/test_pytest_html.py::TestHTML::test_extra_image_separated_rerun[svg-svg] - assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test...
FAILED testing/test_pytest_html.py::TestHTML::test_extra_image_separated_rerun[jpg-jpg] - assert '<a class="image" href="assets/test_extra_image_separated_rerun.py__test...
FAILED testing/test_pytest_html.py::TestHTML::test_environment_xdist - FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-60/test_en...
FAILED testing/test_pytest_html.py::TestHTML::test_environment_xdist_reruns - FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-60/...
FAILED testing/test_pytest_html.py::TestHTML::test_xdist_crashing_worker - FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-tkloczko/pytest-60/tes...
FAILED testing/test_pytest_html.py::TestHTML::test_utf8_surrogate - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_ansi_color[True] - assert '<span class="ansi31">RCOLOR' in '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-...
FAILED testing/test_pytest_html.py::TestHTML::test_collect_error - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_collapsed[True] - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_collapsed[False] - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_setup_and_teardown_in_html - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_setup_failures_are_errors - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_teardown_failures_are_errors - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_extra_log_reporting_respects_capture_no[-s-False] - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_extra_log_reporting_respects_capture_no[--capture=no-False] - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_extra_log_reporting_respects_capture_no[--capture=sys-True] - AttributeError: 'NoneType' object has no attribute 'group'
FAILED testing/test_pytest_html.py::TestHTML::test_extra_log_reporting_respects_show_capture_no[--show-capture=no-False] - AttributeError: 'NoneType' object has no attri...
FAILED testing/test_pytest_html.py::TestHTML::test_extra_log_reporting_respects_show_capture_no[--show-capture=all-True] - AttributeError: 'NoneType' object has no attri...
FAILED testing/test_pytest_html.py::TestHTML::test_environment_table_redact_list - AttributeError: 'NoneType' object has no attribute 'group'
====================================================================== 34 failed, 53 passed in 10.80s ======================================================================
Please try 4.0.0rc0
Just tested 4.0.1 and all testing/test_integration.py and testing/test_unit.py units are failing
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-html-4.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-html-4.0.1-2.fc35.x86
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-html-4.0.1
configfile: tox.ini
testpaths: testing
plugins: html-4.0.1, metadata-3.0.0
collected 67 items
testing/test_e2e.py EE [ 2%]
testing/test_integration.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [ 68%]
FFFFFFFFFFFFFFF [ 91%]
testing/test_unit.py ...... [100%]
==================================== ERRORS ====================================
[..]
=========================== short test summary info ============================
FAILED test_render_collapsed_precedence.py::test_fail - assert False
ERROR test_render_collapsed_precedence.py::test_error - NameError: name 'erro...
=============== 1 failed, 1 passed, 1 skipped, 1 error in 0.02s ================
------------------------------ Captured log call -------------------------------
WARNING urllib3.connectionpool:connectionpool.py:823 Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4b474ecf10>: Failed to establish a new connection: [Errno 111] Connection refused')': /session
WARNING urllib3.connectionpool:connectionpool.py:823 Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4b46c0e580>: Failed to establish a new connection: [Errno 111] Connection refused')': /session
WARNING urllib3.connectionpool:connectionpool.py:823 Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4b47430490>: Failed to establish a new connection: [Errno 111] Connection refused')': /session
=============================== warnings summary ===============================
testing/test_unit.py:5
/home/tkloczko/rpmbuild/BUILD/pytest-html-4.0.1/testing/test_unit.py:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
../../../../../usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2871
../../../../../usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2871
../../../../../usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2871
/usr/lib/python3.8/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR testing/test_e2e.py::test_visible - urllib3.exceptions.MaxRetryError: H...
ERROR testing/test_e2e.py::test_custom_sorting - urllib3.exceptions.MaxRetryE...
FAILED testing/test_integration.py::TestHTML::test_durations[0.4-400] - urlli...
FAILED testing/test_integration.py::TestHTML::test_durations[1-^((?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$)]
FAILED testing/test_integration.py::TestHTML::test_duration_format_hook - url...
FAILED testing/test_integration.py::TestHTML::test_total_number_of_tests_zero
FAILED testing/test_integration.py::TestHTML::test_total_number_of_tests_singular
FAILED testing/test_integration.py::TestHTML::test_total_number_of_tests_plural
FAILED testing/test_integration.py::TestHTML::test_pass - urllib3.exceptions....
FAILED testing/test_integration.py::TestHTML::test_skip - urllib3.exceptions....
FAILED testing/test_integration.py::TestHTML::test_skip_function_marker - url...
FAILED testing/test_integration.py::TestHTML::test_skip_class_marker - urllib...
FAILED testing/test_integration.py::TestHTML::test_fail - urllib3.exceptions....
FAILED testing/test_integration.py::TestHTML::test_xfail - urllib3.exceptions...
FAILED testing/test_integration.py::TestHTML::test_xfail_function_marker - ur...
FAILED testing/test_integration.py::TestHTML::test_xfail_class_marker - urlli...
FAILED testing/test_integration.py::TestHTML::test_xpass - urllib3.exceptions...
FAILED testing/test_integration.py::TestHTML::test_xpass_class_marker - urlli...
FAILED testing/test_integration.py::TestHTML::test_rerun - urllib3.exceptions...
FAILED testing/test_integration.py::TestHTML::test_conditional_xfails - urlli...
FAILED testing/test_integration.py::TestHTML::test_setup_error - urllib3.exce...
FAILED testing/test_integration.py::TestHTML::test_report_title[] - urllib3.e...
FAILED testing/test_integration.py::TestHTML::test_report_title[Special Report]
FAILED testing/test_integration.py::TestHTML::test_resources_inline_css - url...
FAILED testing/test_integration.py::TestHTML::test_resources_css - urllib3.ex...
FAILED testing/test_integration.py::TestHTML::test_custom_content_in_summary
FAILED testing/test_integration.py::TestHTML::test_extra_html - urllib3.excep...
FAILED testing/test_integration.py::TestHTML::test_extra_text[u'\x81'-woE=]
FAILED testing/test_integration.py::TestHTML::test_extra_text['foo'-Zm9v] - u...
FAILED testing/test_integration.py::TestHTML::test_extra_text[b'\\xe2\\x80\\x93'-4oCT]
FAILED testing/test_integration.py::TestHTML::test_extra_json - urllib3.excep...
FAILED testing/test_integration.py::TestHTML::test_extra_url - urllib3.except...
FAILED testing/test_integration.py::TestHTML::test_extra_image[image/png-png]
FAILED testing/test_integration.py::TestHTML::test_extra_image[image/png-image]
FAILED testing/test_integration.py::TestHTML::test_extra_image[image/jpeg-jpg]
FAILED testing/test_integration.py::TestHTML::test_extra_image[image/svg+xml-svg]
FAILED testing/test_integration.py::TestHTML::test_extra_video[video/mp4-mp4]
FAILED testing/test_integration.py::TestHTML::test_xdist - urllib3.exceptions...
FAILED testing/test_integration.py::TestHTML::test_results_table_hook_append
FAILED testing/test_integration.py::TestHTML::test_results_table_hook_insert
FAILED testing/test_integration.py::TestHTML::test_results_table_hook_delete
FAILED testing/test_integration.py::TestHTML::test_results_table_hook_pop - u...
FAILED testing/test_integration.py::TestHTML::test_standard_streams[] - urlli...
FAILED testing/test_integration.py::TestHTML::test_standard_streams[-s] - url...
FAILED testing/test_integration.py::TestLogCapturing::test_all_pass - urllib3...
FAILED testing/test_integration.py::TestLogCapturing::test_setup_error - urll...
FAILED testing/test_integration.py::TestLogCapturing::test_test_fails - urlli...
FAILED testing/test_integration.py::TestLogCapturing::test_teardown_error[True-result0]
FAILED testing/test_integration.py::TestLogCapturing::test_teardown_error[False-result1]
FAILED testing/test_integration.py::TestLogCapturing::test_no_log - urllib3.e...
FAILED testing/test_integration.py::TestLogCapturing::test_rerun - urllib3.ex...
FAILED testing/test_integration.py::TestCollapsedQueryParam::test_default - u...
FAILED testing/test_integration.py::TestCollapsedQueryParam::test_specified[failed,error]
FAILED testing/test_integration.py::TestCollapsedQueryParam::test_specified[FAILED,eRRoR]
FAILED testing/test_integration.py::TestCollapsedQueryParam::test_all - urlli...
FAILED testing/test_integration.py::TestCollapsedQueryParam::test_falsy[] - u...
FAILED testing/test_integration.py::TestCollapsedQueryParam::test_falsy[collapsed=""]
FAILED testing/test_integration.py::TestCollapsedQueryParam::test_falsy[collapsed='']
FAILED testing/test_integration.py::TestCollapsedQueryParam::test_render_collapsed[failed,error]
FAILED testing/test_integration.py::TestCollapsedQueryParam::test_render_collapsed[FAILED,eRRoR]
FAILED testing/test_integration.py::TestCollapsedQueryParam::test_render_collapsed_precedence
============= 59 failed, 6 passed, 4 warnings, 2 errors in 19.06s ==============
Additionally there are deprecation warnings about use deprecated pkg_resources
Full pytest output in attachment python-pytest-html.FAIL.txt
Have you followed these instructions? https://github.com/pytest-dev/pytest-html/blob/master/docs/development.rst#running-tests
Another tip is to look what CI does.
~Unit tests should not fail in the absence of browser however.~ They are passing according to your output.
Everything passes on master branch.
Issue is that such tricks should not be needed because unittest and pytest allows start and stop anything as kind of service during test suite session
https://stackoverflow.com/questions/14281740/best-practice-for-starting-stopping-daemons-as-part-of-a-unittest-using-pytest
I welcome a PR with such an implementation. 👍
Closing. This issue is outdated now.