Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another attempt to fix flakiness in test_subprocess::test_basic #1548

Merged
merged 1 commit into from
May 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions trio/tests/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,12 @@ def got_signal(proc, sig):


async def test_basic():
repr_template = "<trio.Process {!r}: {{}}>".format(EXIT_TRUE)
async with await open_process(EXIT_TRUE) as proc:
assert isinstance(proc, Process)
assert repr(proc) == repr_template.format(
"running with PID {}".format(proc.pid)
)
pass
assert isinstance(proc, Process)
assert proc._pidfd is None
assert proc.returncode == 0
assert repr(proc) == repr_template.format("exited with status 0")
assert repr(proc) == f"<trio.Process {EXIT_TRUE}: exited with status 0>"

async with await open_process(EXIT_FALSE) as proc:
pass
Expand All @@ -69,9 +66,11 @@ async def test_basic():
async def test_auto_update_returncode():
p = await open_process(SLEEP(9999))
assert p.returncode is None
assert "running" in repr(p)
p.kill()
p._proc.wait()
assert p.returncode is not None
assert "exited" in repr(p)
assert p._pidfd is None
assert p.returncode is not None

Expand Down