Skip to content

Commit

Permalink
Replace py.io.StdCaptureFD with _pytest.capture.MultiCapture. Refs de…
Browse files Browse the repository at this point in the history
  • Loading branch information
fschulze authored and markmcclain committed Jan 8, 2024
1 parent e5c49e9 commit d8878b0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions server/test_devpi_server/conftest.py
@@ -1,3 +1,4 @@
from _pytest import capture
import re
from webtest.forms import Upload
import json
Expand Down Expand Up @@ -1040,8 +1041,11 @@ def devpi(server_dir, args):
from _pytest.pytester import RunResult
m = MonkeyPatch()
m.setenv("DEVPISERVER_SERVERDIR", getattr(server_dir, 'strpath', server_dir))
cap = py.io.StdCaptureFD()
cap.startall()
cap = capture.MultiCapture(
in_=capture.FDCapture(0),
out=capture.FDCapture(1),
err=capture.FDCapture(2))
cap.start_capturing()
now = time.time()
if args[0] == 'devpi-gen-config':
m.setattr("sys.argv", [devpigenconfig])
Expand All @@ -1059,7 +1063,8 @@ def devpi(server_dir, args):
entry_point(argv=args)
finally:
m.undo()
out, err = cap.reset()
(out, err) = cap.readouterr()
cap.stop_capturing()
del cap
return RunResult(
0, out.split("\n"), err.split("\n"), time.time() - now)
Expand Down

0 comments on commit d8878b0

Please sign in to comment.