Skip to content

Commit

Permalink
Merge pull request #2205 from tjstum/fixtests
Browse files Browse the repository at this point in the history
Improve stability of tests_subprocess
  • Loading branch information
oremanj authored Jan 8, 2022
2 parents 7b0001d + d38a406 commit 147a545
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions trio/tests/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
sleep_forever,
Process,
run_process,
TrioDeprecationWarning,
ClosedResourceError,
)
from ..lowlevel import open_process
Expand All @@ -41,7 +40,11 @@ def python(code):
EXIT_TRUE = python("sys.exit(0)")
EXIT_FALSE = python("sys.exit(1)")
CAT = python("sys.stdout.buffer.write(sys.stdin.buffer.read())")
SLEEP = lambda seconds: python("import time; time.sleep({})".format(seconds))

if posix:
SLEEP = lambda seconds: ["/bin/sleep", str(seconds)]
else:
SLEEP = lambda seconds: python("import time; time.sleep({})".format(seconds))


def got_signal(proc, sig):
Expand Down

0 comments on commit 147a545

Please sign in to comment.