Skip to content

Conversation

@oremanj
Copy link
Member

@oremanj oremanj commented Jan 13, 2019

Previously this would fail on kqueue platforms.

@oremanj oremanj requested a review from njsmith January 13, 2019 22:29
@codecov
Copy link

codecov bot commented Jan 13, 2019

Codecov Report

Merging #854 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #854      +/-   ##
==========================================
+ Coverage   99.21%   99.21%   +<.01%     
==========================================
  Files         101      101              
  Lines       12225    12240      +15     
  Branches      895      896       +1     
==========================================
+ Hits        12129    12144      +15     
  Misses         75       75              
  Partials       21       21
Impacted Files Coverage Δ
trio/_subprocess_platform/kqueue.py 100% <ø> (ø) ⬆️
trio/tests/test_subprocess.py 100% <100%> (ø) ⬆️
trio/_subprocess.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1301544...fe8eab1. Read the comment docs.

@njsmith
Copy link
Member

njsmith commented Jan 14, 2019

Looks good, but seems to have caused a coverage drop in some of the low-level code. Maybe we're not testing wait, cancel, wait again?

async with _core.open_nursery() as nursery:
with move_on_after(0.1):
await proc.wait()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timeout here is a bit sloppy... it slows down the tests slightly, and if the OS scheduler decides it hates us then there's no guarantee that proc.wait will have reached the actual blocking point before the timeout fires. How about we do two rounds:

# Check that wait (including multi-wait) tolerates being cancelled
async with _core.open_nursery() as nursery:
    nursery.start_soon(proc.wait)
    nursery.start_soon(proc.wait)
    nursery.start_soon(proc.wait)
    await wait_all_tasks_blocked()
    nursery.cancel_scope.cancel()

# Now try waiting for real
async with _core.open_nursery() as nursery:
    nursery.start_soon(proc.wait)
    nursery.start_soon(proc.wait)
    nursery.start_soon(proc.wait)
    await wait_all_tasks_blocked()
    proc.kill()

@njsmith
Copy link
Member

njsmith commented Jan 21, 2019

LGTM. There was a conflict with #862, whcih I think I resolved. If someone notices the CI passed while I wasn't looking, feel free to merge :-)

@sorcio sorcio merged commit abd3486 into python-trio:master Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants