From 148e3c582afc6ae040d2ddcf09fade339a50dd1a Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 20 Nov 2020 17:50:58 +0200 Subject: [PATCH] pytester: always close stdin pipe in pytester.run() If the user passed stdin=PIPE for some reason, they have no way to close it themselves since it is not exposed. --- src/_pytest/pytester.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index e55b3ec1a..dd13ef4ce 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -1349,7 +1349,7 @@ class Pytester: stderr=f2, close_fds=(sys.platform != "win32"), ) - if isinstance(stdin, bytes): + if popen.stdin is not None: popen.stdin.close() def handle_timeout() -> None: