File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -221,14 +221,22 @@ def foo() -> None:
221
221
# if this test fails, this will hang, triggering a timeout.
222
222
os .waitpid (child_pid , 0 )
223
223
else :
224
+ # this is necessary because os._exit doesn't unwind the stack,
225
+ # so coverage doesn't get to automatically stop and save
226
+ # coverage information.
224
227
try :
225
228
import coverage
226
229
227
230
cov = coverage .Coverage .current ()
231
+ # the following pragmas are necessary because if coverage:
232
+ # - isn't running, then it can't record the branch not
233
+ # taken
234
+ # - isn't installed, then it can't record the ImportError
235
+
228
236
if cov : # pragma: no branch
229
237
cov .stop ()
230
238
cov .save ()
231
239
except ImportError : # pragma: no cover
232
240
pass
233
241
234
- os ._exit (0 ) # pragma: no cover
242
+ os ._exit (0 ) # pragma: no cover # coverage was stopped above.
You can’t perform that action at this time.
0 commit comments