Skip to content

Pytest/capsys fixture not capturing stdout #1132

Closed
@derwolfe

Description

@derwolfe

Py.test isn't capturing the output from stdout or stderr.

import sys

stdout = sys.stdout

def test_use_logger(capsys):
    stdout.write("called")
    out, err = capsys.readouterr()
    assert "called" in out

The test case was run and reproduced on OS X 10.11 with pythons 2.7.10 and 3.5.0.

The versions used are:

py==1.4.30
pytest==2.8.2

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions