File tree Expand file tree Collapse file tree 1 file changed +8
-20
lines changed
Expand file tree Collapse file tree 1 file changed +8
-20
lines changed Original file line number Diff line number Diff line change 11import pytest
22import typing
33import os
4- import signal
4+ import sys
55
66
77@pytest .fixture (scope = "session" , autouse = True )
8- def _cocoindex_env_fixture () -> typing .Generator [None , None , None ]:
8+ def _cocoindex_env_fixture (
9+ request : pytest .FixtureRequest ,
10+ ) -> typing .Generator [None , None , None ]:
911 """Shutdown the subprocess pool at exit."""
1012
1113 yield
1214
13- try :
14- print ("Shutdown the subprocess pool at exit in hook." )
15- import cocoindex .subprocess_exec
16-
17- if os .name == "nt" :
18- original_sigint_handler = signal .getsignal (signal .SIGINT )
19- try :
20- signal .signal (signal .SIGINT , signal .SIG_IGN )
21- cocoindex .subprocess_exec .shutdown_pool_at_exit ()
22- finally :
23- try :
24- signal .signal (signal .SIGINT , original_sigint_handler )
25- except ValueError : # noqa: BLE001
26- pass
27- else :
28- cocoindex .subprocess_exec .shutdown_pool_at_exit ()
29- except (ImportError , AttributeError ): # noqa: BLE001
30- pass
15+ if sys .platform .startswith ("win" ):
16+ # If any test failed, let pytest exit normally with nonzero code
17+ if request .session .testsfailed == 0 :
18+ os ._exit (0 ) # immediate success exit (skips atexit/teardown)
You can’t perform that action at this time.
0 commit comments