Skip to content

disabling capture in cli doesn't work #13731

Closed

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.

Activity

  1. RonnyPfannschmidt commented on Sep 15, 2025

    @RonnyPfannschmidt
    Member

    The capture fixtures enforce specific capture for specific tests

    So it ought to fail

    We should perhaps add a note/warning to the output

  2. added
    type: docsdocumentation improvement, missing or needing clarification
    on Nov 3, 2025
  3. Zac-HD commented on Nov 3, 2025

    @Zac-HD
    Member

    I think it'd be sufficient to document that using a capture fixture takes priority over --capture=no in the tutorial.

  4. added a commit that references this issue on Dec 28, 2025
    8f5b07d
  5. added a commit that references this issue on Dec 28, 2025
    dfdbe24
  6. added a commit that references this issue on Dec 28, 2025
    35dfe8d
  7. added a commit that references this issue on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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