Skip to content

Commit c36a905

Browse files
committed
Move CLOSE_STDIN to class
1 parent 4fca86e commit c36a905

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/_pytest/pytester.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
u"/var/lib/sss/mc/passwd"
3737
]
3838

39-
CLOSE_STDIN = object
40-
4139

4240
def pytest_addoption(parser):
4341
parser.addoption(
@@ -475,6 +473,8 @@ class Testdir(object):
475473
476474
"""
477475

476+
CLOSE_STDIN = object
477+
478478
class TimeoutExpired(Exception):
479479
pass
480480

@@ -1059,15 +1059,15 @@ def popen(
10591059
env["USERPROFILE"] = env["HOME"]
10601060
kw["env"] = env
10611061

1062-
if stdin is CLOSE_STDIN:
1062+
if stdin is Testdir.CLOSE_STDIN:
10631063
kw["stdin"] = subprocess.PIPE
10641064
elif isinstance(stdin, bytes):
10651065
kw["stdin"] = subprocess.PIPE
10661066
else:
10671067
kw["stdin"] = stdin
10681068

10691069
popen = subprocess.Popen(cmdargs, stdout=stdout, stderr=stderr, **kw)
1070-
if stdin is CLOSE_STDIN:
1070+
if stdin is Testdir.CLOSE_STDIN:
10711071
popen.stdin.close()
10721072
elif isinstance(stdin, bytes):
10731073
popen.stdin.write(stdin)
@@ -1093,7 +1093,7 @@ def run(self, *cmdargs, **kwargs):
10931093
__tracebackhide__ = True
10941094

10951095
timeout = kwargs.pop("timeout", None)
1096-
stdin = kwargs.pop("stdin", CLOSE_STDIN)
1096+
stdin = kwargs.pop("stdin", Testdir.CLOSE_STDIN)
10971097
raise_on_kwargs(kwargs)
10981098

10991099
popen_kwargs = {"stdin": stdin}

0 commit comments

Comments
 (0)