pytest
pytest copied to clipboard
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
Maybe related to #11483, in my code (like my source code, not inside of any testing files for pytest) I have a section that checks for an optional dependency and...
Bug report generated by co-pilot EXCEPT me having to edit a bunch since it was confusing and too much blabbing: **Summary:** On Python 3.13 and 3.14 (RC) under Windows, pytest...
With `Python 3.13.7` and `pytest-8.4.2`, doing this in a `conftest.py`: ```python def pytest_addoption(parser): parser.addoption("shuffle") # without -- ``` results in: ```pytb Traceback (most recent call last): ... File ".../conftest.py", line...
I was debugging multiple test failures which I could reduce to a failure showing already in `testing/test_warnings.py` ``` pytest -s testing/test_warnings.py -k test_warning_recorded_hook ============ FAILURES ================== _______________ test_warning_recorded_hook ____________________ pytester...
See simple example: ``` import sys def test_dummy_test_with_traceback(request, capteesys): print(f"Hello world stdout", flush=True) print(f"Hello world stderr",file=sys.stderr, flush=True) ``` Run with: ``` $ pytest -svv test.py ============================================================================================================================= test session starts =============================================================================================================================...
Using flag `--capture=no` or `-s` should disable capturing. my venv: ``` ❯ pip list Package Version --------- ------- iniconfig 2.1.0 packaging 25.0 pip 24.0 pluggy 1.6.0 Pygments 2.19.2 pytest 8.4.2...
Fixes #8973 When calling `reporter.write()` with `flush=True` during test execution, the output was not appearing in the terminal because pytest's output capture system intercepts writes to sys.stdout. This fix duplicates...
Fixed color inconsistency in verbose mode where test status showed green instead of yellow for passed tests with warnings. closes #13201
- closes #13564
### Summary Fixes #13822 When `/tmp/setup.py` exists on the system, pytest incorrectly identifies `/tmp` as the project root, causing test node IDs to include full paths under `/tmp` instead of...