From 2f47624b19d53db7667c54dd6bcf2232e1dc24e3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 15 Mar 2018 21:26:40 -0400 Subject: [PATCH] Allow DontReadFromInput to produce iterator without error. Fixes #3314. --- _pytest/capture.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_pytest/capture.py b/_pytest/capture.py index 6e2139445..6545e6fa3 100644 --- a/_pytest/capture.py +++ b/_pytest/capture.py @@ -574,7 +574,10 @@ class DontReadFromInput(object): raise IOError("reading from stdin while output is captured") readline = read readlines = read - __iter__ = read + __next__ = read + + def __iter__(self): + return self def fileno(self): raise UnsupportedOperation("redirected stdin is pseudofile, "