python-trio / trio-asyncio

a re-implementation of the asyncio mainloop on top of Trio
Other
188 stars 37 forks source link

Streamline handling of async loop exit #81

Closed oremanj closed 4 years ago

oremanj commented 4 years ago

I ran into some deadlocks and other issues ("loop must be stopped before it can be closed" during teardown) while writing tests for #76 that cancelled the open_loop() block. This fixes them, doesn't break anything else, and seems like a good idea in theory.

codecov[bot] commented 4 years ago

Codecov Report

Merging #81 into master will increase coverage by 0.10%. The diff coverage is 76.47%.

@@            Coverage Diff             @@
##           master      #81      +/-   ##
==========================================
+ Coverage   77.95%   78.05%   +0.10%     
==========================================
  Files          11       11              
  Lines        1288     1285       -3     
  Branches      180      180              
==========================================
- Hits         1004     1003       -1     
+ Misses        206      204       -2     
  Partials       78       78              
Impacted Files Coverage Δ
trio_asyncio/_base.py 81.81% <69.23%> (+0.09%) :arrow_up:
trio_asyncio/_loop.py 77.31% <100.00%> (+0.39%) :arrow_up: