diff --git a/CHANGELOG b/CHANGELOG index 312bb60d0..561649b73 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -25,6 +25,10 @@ Changes between 2.4.1 and 2.4.2 docs. +- remove attempt to "dup" stdout at startup. + the normal capturing should catch enough possibilities + of tests messing up standard FDs. + Changes between 2.4.0 and 2.4.1 ----------------------------------- diff --git a/_pytest/terminal.py b/_pytest/terminal.py index ab132d45e..55b5cd219 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -33,25 +33,7 @@ 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. (unless capturing is off/sys) - stdout = sys.stdout - if hasattr(os, "dup") and hasattr(stdout, "fileno"): - try: - newstdout = py.io.dupfile(stdout, buffering=1, - encoding=stdout.encoding) - except (AttributeError, ValueError): - pass - else: - assert stdout.encoding == newstdout.encoding - stdout = newstdout - #we don't close on shutdown because this can - #cause logging to fail on a second close - #(not really clear to me how it happens exactly, though) - #config.pluginmanager.add_shutdown(fin) - - reporter = TerminalReporter(config, stdout) + reporter = TerminalReporter(config, sys.stdout) config.pluginmanager.register(reporter, 'terminalreporter') if config.option.debug or config.option.traceconfig: def mywriter(tags, args): diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 3b4be7be6..e36b890bc 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -704,14 +704,3 @@ def test_terminal_summary(testdir): *==== hello ====* world """) - -@pytest.mark.xfail("not hasattr(os, 'dup')") -def test_fd_fixing(testdir): - testdir.makepyfile(""" - import os - os.close(1) - def test_fdclose(): - os.close(2) - """) - result = testdir.runpytest("-s") - result.stdout.fnmatch_lines("*1 pass*")