https://github.com/buzz/pytest-html-example
pytest-html report example
https://github.com/buzz/pytest-html-example
Last synced: about 2 months ago
JSON representation
pytest-html report example
- Host: GitHub
- URL: https://github.com/buzz/pytest-html-example
- Owner: buzz
- Created: 2021-02-20T00:30:25.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-20T00:39:36.000Z (about 5 years ago)
- Last Synced: 2025-09-02T14:49:09.470Z (7 months ago)
- Language: HTML
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pytest + pytest-html
Test repository for [StackOverflow question PyTest: Interactive Output (instead
of pure
ASCII)](https://stackoverflow.com/questions/66225251/pytest-interactive-output-instead-of-pure-ascii).
```
$ pip install -r requirements.txt
$ pytest --showlocals --html=report.html --self-contained-html testmodule/test.py
=================================== test session starts ====================================
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /tmp/test
plugins: html-3.1.1, metadata-1.11.0
collected 2 items
testmodule/test.py F. [100%]
========================================= FAILURES =========================================
_________________________________________ test_add _________________________________________
def test_add():
foo = 10
bar = 12
> assert add(foo, bar) == 22
E assert -2 == 22
E + where -2 = add(10, 12)
bar = 12
foo = 10
testmodule/test.py:12: AssertionError
-------------------- generated html file: file:///tmp/test/report.html ---------------------
================================= short test summary info ==================================
FAILED testmodule/test.py::test_add - assert -2 == 22
=============================== 1 failed, 1 passed in 0.02s ================================
```
This will generate a `report.html` for you.
