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 âŊ python3 --version Python 3.12.3 ``` my OS: ``` Ubuntu 24.04 on WSL ``` the test: ```python def test_capsys(capsys): print('Hello World!') captured = capsys.readouterr() assert captured.out == 'Hello World!\n' assert captured.err == '' ``` To reproduce it, run `pytest --capture=no test.py` or `pytest -s test.py`. The test should fail as capture is disabled but it still pass.
Activity
RonnyPfannschmidt commentedon Sep 15, 2025
The capture fixtures enforce specific capture for specific tests
So it ought to fail
We should perhaps add a note/warning to the output
Zac-HD commentedon Nov 3, 2025
I think it'd be sufficient to document that using a capture fixture takes priority over
--capture=noin the tutorial.Docs: clarify capture fixture precedence over -s (#14053)
Docs: clarify capture fixture precedence over -s (#14053)
Docs: clarify capture fixture precedence over -s (#14053) (#14073)
build(security): Update dependency pytest to v9.0.3 [SECURITY] (#217)
chore(deps): update root dev dependencies (patch)
ðïļ Update dependency pytest to v9 [SECURITY] (#16)
[SECURITY] Update dependency pytest to v9 [SECURITY] (#2)
Update dependency pytest to v9 (#35)