Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add disabled() method to capsys and capfd #1600

Conversation

nicoddemus
Copy link
Member

Wanted to get feedback if I should continue working on this.

Missing docs mostly

Fix #1599

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 92.379% when pulling e179bc4 on nicoddemus:issue-1599-disable-cap-fixtures into b5bd4d9 on pytest-dev:features.

@nicoddemus nicoddemus force-pushed the issue-1599-disable-cap-fixtures branch from e179bc4 to 4a3d57f Compare June 9, 2016 00:07
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 92.379% when pulling 4a3d57f on nicoddemus:issue-1599-disable-cap-fixtures into 9232389 on pytest-dev:features.

@RonnyPfannschmidt
Copy link
Member

Can you check it against xdist?

@The-Compiler
Copy link
Member

I like this! It'd also make it easier to add an uncaptured pytest.print(msg) for easy printf-style debugging (without having to use -s and being greeted by a firehose of output).

@nicoddemus
Copy link
Member Author

Nice idea on pytest.print... but I think this should be in a separate issue, specially to discuss UI/implementation.

@nicoddemus
Copy link
Member Author

Can you check it against xdist?

Good thinking, will do it later.

@nicoddemus
Copy link
Member Author

Testing with xdist everything seems to work:

import pytest

@pytest.mark.parametrize('i', list(range(100)))
def test(i, capsys):
    with capsys.disabled():
        print(i, 'hey')
$ py.test -n3
============================= test session starts =============================
platform win32 -- Python 3.5.0, pytest-2.10.0.dev1, py-1.4.31, pluggy-0.3.1
rootdir: X:\pytest, inifile: tox.ini
plugins: hypothesis-3.1.0, xdist-1.14
gw0 [100] / gw1 [100] / gw2 [100]
scheduling tests via LoadScheduling
....................................................................................................
========================= 100 passed in 1.72 seconds ==========================

The output does not show, but neither does it show if you pass -s; that's a general problem currently known with pytest-xdist, unfortunately.

@The-Compiler The-Compiler mentioned this pull request Jun 9, 2016
@nicoddemus nicoddemus force-pushed the issue-1599-disable-cap-fixtures branch from 4a3d57f to 72bf11c Compare June 19, 2016 17:16
@nicoddemus
Copy link
Member Author

Added CHANGELOG and documentation, I think the PR is ready for a final review. 😁

@nicoddemus nicoddemus changed the title [WIP] Add disabled() method to capsys and capfd (feedback wanted) Add disabled() method to capsys and capfd Jun 19, 2016
@coveralls
Copy link

coveralls commented Jun 19, 2016

Coverage Status

Coverage decreased (-0.05%) to 92.378% when pulling 72bf11c on nicoddemus:issue-1599-disable-cap-fixtures into 308396a on pytest-dev:features.

@RonnyPfannschmidt RonnyPfannschmidt merged commit f3aead8 into pytest-dev:features Jun 20, 2016
@nicoddemus nicoddemus deleted the issue-1599-disable-cap-fixtures branch June 20, 2016 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants