don't manipulate FDs at all if output capturing is turned off.
This commit is contained in:
parent
3ab9b48782
commit
030c337c68
|
@ -34,9 +34,10 @@ def pytest_addoption(parser):
|
|||
def pytest_configure(config):
|
||||
config.option.verbose -= config.option.quiet
|
||||
# we try hard to make printing resilient against
|
||||
# later changes on FD level.
|
||||
# later changes on FD level. (unless capturing is turned off)
|
||||
stdout = py.std.sys.stdout
|
||||
if hasattr(os, 'dup') and hasattr(stdout, 'fileno'):
|
||||
capture = config.option.capture != "no"
|
||||
if capture and hasattr(os, 'dup') and hasattr(stdout, 'fileno'):
|
||||
try:
|
||||
newstdout = py.io.dupfile(stdout, buffering=1,
|
||||
encoding=stdout.encoding)
|
||||
|
|
|
@ -677,6 +677,13 @@ def test_fdopen_kept_alive_issue124(testdir):
|
|||
"*2 passed*"
|
||||
])
|
||||
|
||||
def test_nofd_manipulation_with_capture_disabled(testdir):
|
||||
from _pytest.terminal import pytest_configure
|
||||
config = testdir.parseconfig("--capture=no")
|
||||
stdout = sys.stdout
|
||||
pytest_configure(config)
|
||||
reporter = config.pluginmanager.getplugin('terminalreporter')
|
||||
assert reporter._tw._file == stdout
|
||||
|
||||
def test_tbstyle_native_setup_error(testdir):
|
||||
p = testdir.makepyfile("""
|
||||
|
@ -684,7 +691,7 @@ def test_tbstyle_native_setup_error(testdir):
|
|||
@pytest.fixture
|
||||
def setup_error_fixture():
|
||||
raise Exception("error in exception")
|
||||
|
||||
|
||||
def test_error_fixture(setup_error_fixture):
|
||||
pass
|
||||
""")
|
||||
|
|
Loading…
Reference in New Issue