remove fd-fixing attempt at startup of pytest. It's
not clear it's actually needed and it's not nice to still do FD-dupping when "-s" is specified.
This commit is contained in:
parent
3d00cd35fc
commit
cec7d47c1f
|
@ -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
|
||||
-----------------------------------
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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*")
|
||||
|
|
Loading…
Reference in New Issue