Skip to content

disabling capture in cli doesn't work #13731

@gzzi

Description

@gzzi

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: docsdocumentation improvement, missing or needing clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions