Install pytest-html and then run test with --html=pytest_report.html option.

Answer from brada on Stack Overflow
🌐
pytest
docs.pytest.org › en › stable › _modules › _pytest › reports.html
_pytest.reports - pytest documentation
May #: be used by other plugins to add arbitrary information to reports. self.sections = list(sections) self.__dict__.update(extra) @property def location( # type:ignore[override] self, ) -> tuple[str, int | None, str] | None: return (self.fspath, None, self.fspath) def __repr__(self) -> str: return f"<CollectReport {self.nodeid!r} lenresult={len(self.result)} outcome={self.outcome!r}>" class CollectErrorRepr(TerminalRepr): def __init__(self, msg: str) -> None: self.longrepr = msg def toterminal(self, out: TerminalWriter) -> None: out.line(self.longrepr, red=True) def pytest_report_to_serializable( report: CollectReport | TestReport, ) -> dict[str, Any] | None: if isinstance(report, TestReport | CollectReport): data = report._to_json() data["$report_type"] = report.__class__.__name__ return data # TODO: Check if this is actually reachable.
🌐
Readthedocs
pytest-cov.readthedocs.io › en › latest › reporting.html
Reporting - pytest-cov 7.1.0 documentation
It is possible to generate any combination of the reports for a single test run. The available reports are terminal (with or without missing line numbers shown), HTML, XML, JSON, Markdown (either in ‘write’ or ‘append’ mode to file), LCOV and annotated source code. The default is terminal report without line numbers: pytest --cov=myproj tests/ -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- Name Stmts Miss Cover ---------------------------------------- myproj/__init__ 2 0 100% myproj/myproj 257 13 94% myproj/feature4286 94 7 92% ---------------------------------------- TOTAL 353 20 94%
🌐
pytest
docs.pytest.org › en › 7.1.x › how-to › output.html
Managing pytest’s output — pytest documentation
JUnit XML specification seems to indicate that "time" attribute should report total test execution times, including setup and teardown (1, 2). It is the default pytest behavior.
🌐
Neetz World
neetabirajdar.github.io › blog › tech_pytest_report
Test Report With Pytest - Neetz World
April 2, 2023 - Pytest-sugar is a plugin for pytest that shows failures and errors instantly and shows a progress bar. ... Failed details Report: Testcases which are skipped, failed, passed are shown in a list.
🌐
pytest
docs.pytest.org › en › 6.2.x › _modules › _pytest › reports.html
_pytest.reports — pytest documentation
# Used by pytest to add captured text : from ``stdout`` and ``stderr``, # but may be used by other plugins : to add arbitrary information to # reports. self.sections = list(sections) self.__dict__.update(extra) @property def location(self): return (self.fspath, None, self.fspath) def __repr__(self) -> str: return "<CollectReport {!r} lenresult={} outcome={!r}>".format( self.nodeid, len(self.result), self.outcome ) class CollectErrorRepr(TerminalRepr): def __init__(self, msg: str) -> None: self.longrepr = msg def toterminal(self, out: TerminalWriter) -> None: out.line(self.longrepr, red=True) def pytest_report_to_serializable( report: Union[CollectReport, TestReport] ) -> Optional[Dict[str, Any]]: if isinstance(report, (TestReport, CollectReport)): data = report._to_json() data["$report_type"] = report.__class__.__name__ return data # TODO: Check if this is actually reachable.
🌐
pytest
docs.pytest.org › en › stable › how-to › output.html
Managing pytest’s output - pytest documentation
More than one character can be used, so for example to only see failed and skipped tests, you can execute: $ pytest -rfs =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-9.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 6 items test_example.py .FEsxX [100%] ================================== ERRORS ================================== _______________________ ERROR at setup of test_error _______________________ @pytest.fixture def error_fixture(): > assert 0 E assert 0 test_example.py:6: AssertionError ===================
Find elsewhere
🌐
PyPI
pypi.org › project › pytest-json-report
pytest-json-report · PyPI
It can report a summary, test details, captured output, logs, exception tracebacks and more. Additionally, you can use the available fixtures and hooks to add metadata and customize the report as you like. ... Just run pytest with --json-report.
      » pip install pytest-json-report
    
Published   Mar 15, 2022
Version   1.5.0
🌐
Readthedocs
pytest-html.readthedocs.io › en › latest › user_guide.html
User Guide — pytest-html documentation - Read the Docs
def pytest_html_report_title(report): report.title = "My very own title!" The Environment section is provided by the pytest-metadata plugin, and can be accessed via the pytest_configure and pytest_sessionfinish hooks: To modify the Environment section before tests are run, use pytest_configure:
🌐
AWS
docs.aws.amazon.com › aws codebuild › user guide › test reports in aws codebuild › test frameworks › set up test reporting with pytest
Set up test reporting with pytest - AWS CodeBuild
version: 0.2 phases: install: runtime-versions: python: 3.7 commands: - pip3 install pytest build: commands: - python -m pytest --junitxml=<test report directory>/<report filename> reports: pytest_reports: files: - <report filename> base-directory: <test report directory> file-format: JUNITXML
🌐
pytest
docs.pytest.org › en › stable › how-to › assert.html
How to write and report assertions in tests - pytest documentation
$ pytest test_assert1.py =========================== test session starts ============================ platform linux -- Python 3.x.y, pytest-9.x.y, pluggy-1.x.y rootdir: /home/sweet/project collected 1 item test_assert1.py F [100%] ================================= FAILURES ================================= ______________________________ test_function _______________________________ def test_function(): > assert f() == 4 E assert 3 == 4 E + where 3 = f() test_assert1.py:6: AssertionError ========================= short test summary info ========================== FAILED test_assert1.py::test_function - assert 3 == 4 ============================ 1 failed in 0.12s ============================= pytest has support for showing the values of the most common subexpressions including calls, attributes, comparisons, and binary and unary operators. (See Demo of Python failure reports with pytest).
🌐
PyPI
pypi.org › project › pytest-md-report
pytest-md-report · PyPI
A pytest plugin to generate test outcomes reports with markdown table format.
      » pip install pytest-md-report
    
Published   May 02, 2025
Version   0.7.0
🌐
Pytest with Eric
pytest-with-eric.com › plugins › pytest-html
How To Create Custom HTML Test Reports With pytest-html | Pytest with Eric
May 24, 2024 - Let’s run the tests. The --html=report.html flag tells Pytest to generate an HTML report in this directory and call it report.html .
🌐
Real Python
realpython.com › pytest-python-testing
pytest Tutorial: Effective Python Testing – Real Python
December 8, 2024 - If you want to measure how well your tests cover your implementation code, then you can use the coverage package. pytest-cov integrates coverage, so you can run pytest --cov to see the test coverage report and boast about it on your project ...
🌐
pytest
docs.pytest.org › en › 7.1.x › how-to › assert.html
How to write and report assertions in tests — pytest documentation
$ pytest -q test_foocompare.py F [100%] ================================= FAILURES ================================= _______________________________ test_compare _______________________________ def test_compare(): f1 = Foo(1) f2 = Foo(2) > assert f1 == f2 E assert Comparing Foo instances: E vals: 1 != 2 test_foocompare.py:12: AssertionError ========================= short test summary info ========================== FAILED test_foocompare.py::test_compare - assert Comparing Foo instances: 1 failed in 0.12s · Reporting details about a failing assertion is achieved by rewriting assert statements before they are run. Rewritten assert statements put introspection information into the assertion failure message. pytest only rewrites test modules directly discovered by its test collection process, so asserts in supporting modules which are not themselves test modules will not be rewritten.
🌐
PyPI
pypi.org › project › pytest-html
pytest-html · PyPI
Software Development :: Testing · Utilities · Report project as malware · pytest-html is a plugin for pytest that generates a HTML report for test results. Documentation · Release Notes · Issue Tracker · Code · We welcome contributions.
      » pip install pytest-html
    
Published   Jan 19, 2026
Version   4.2.0
🌐
Allure Report
allurereport.org › docs › pytest
Allure Report Docs – Pytest
Learn how to integrate Allure with pytest to generate rich, interactive test reports. Follow step-by-step setup, test execution, and report generation guidance.
🌐
GitHub
github.com › numirias › pytest-json-report
GitHub - numirias/pytest-json-report: 🗒️ A pytest plugin to report test results as JSON
It can report a summary, test details, captured output, logs, exception tracebacks and more. Additionally, you can use the available fixtures and hooks to add metadata and customize the report as you like. ... List of fields to omit in the report (choose from: collectors, log, traceback, streams, warnings, keywords) ... Just run pytest with --json-report.
Starred by 153 users
Forked by 45 users
Languages   Python 100.0% | Python 100.0%
🌐
PyPI
pypi.org › project › pytest-reporter
pytest-reporter · PyPI
See pytest-reporter-html1 for a full reference implementation. The standard context available for all templates include the following: config: Config · session: Session · started: Unix timestamp when session started · ended: Unix timestamp when session was finished · warnings[]: List of warnings.WarningMessage · items: Dictionary of collected items with nodeid as keys · tests[]: List of each test run as dictionaries with the following keys: item: Item ·
      » pip install pytest-reporter
    
Published   Feb 28, 2024
Version   0.5.3