From c72a1b29330c5fc6027b5438a9e826c522c89bd0 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 29 Apr 2020 14:33:57 +0300 Subject: [PATCH] config: replace usage of py.io.dupfile As part of the effort to remove uses of `py`. --- src/_pytest/config/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 6d18eeb65..8e5944fc7 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -308,7 +308,9 @@ class PytestPluginManager(PluginManager): err = sys.stderr encoding = getattr(err, "encoding", "utf8") try: - err = py.io.dupfile(err, encoding=encoding) + err = open( + os.dup(err.fileno()), mode=err.mode, buffering=1, encoding=encoding, + ) except Exception: pass self.trace.root.setwriter(err.write)