config: replace usage of py.io.dupfile

As part of the effort to remove uses of `py`.
This commit is contained in:
Ran Benita 2020-04-29 14:33:57 +03:00
parent e5d6e58625
commit c72a1b2933
1 changed files with 3 additions and 1 deletions

View File

@ -308,7 +308,9 @@ class PytestPluginManager(PluginManager):
err = sys.stderr err = sys.stderr
encoding = getattr(err, "encoding", "utf8") encoding = getattr(err, "encoding", "utf8")
try: try:
err = py.io.dupfile(err, encoding=encoding) err = open(
os.dup(err.fileno()), mode=err.mode, buffering=1, encoding=encoding,
)
except Exception: except Exception:
pass pass
self.trace.root.setwriter(err.write) self.trace.root.setwriter(err.write)