Skip to content

Commit 597a86a

Browse files
committed
cleanup after pass
1 parent 900e029 commit 597a86a

File tree

3 files changed

+8
-21
lines changed

3 files changed

+8
-21
lines changed

.github/workflows/_test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ jobs:
5151
- name: Python build
5252
run: |
5353
${{ matrix.platform.python_exec }} -m maturin develop -E all
54-
- name: Python tests (non-Windows)
54+
- name: Python type check (mypy)
55+
run: |
56+
${{ matrix.platform.python_exec }} -m mypy python
57+
- name: Python tests
5558
if: ${{ !startsWith(matrix.platform.runner, 'windows') }}
5659
run: |
5760
${{ matrix.platform.python_exec }} -m pytest --capture=no python/cocoindex/tests
58-
- name: Python tests (Windows)
61+
- name: Python tests (Windows cmd)
5962
if: ${{ startsWith(matrix.platform.runner, 'windows') }}
60-
# shell: cmd
61-
run: |
62-
${{ matrix.platform.python_exec }} -m pytest --capture=no python/cocoindex/tests
63-
- name: Python type check (mypy)
63+
shell: cmd # Use `cmd` to run test for Windows, as PowerShell doesn't detect exit code by `os._exit(0)` correctly.
6464
run: |
65-
${{ matrix.platform.python_exec }} -m mypy python
65+
${{ matrix.platform.python_exec }} -m pytest --capture=no python/cocoindex/tests

python/cocoindex/subprocess_exec.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,10 @@
4040
def shutdown_pool_at_exit() -> None:
4141
"""Best-effort shutdown of the global ProcessPoolExecutor on interpreter exit."""
4242
global _pool, _pool_cleanup_registered # pylint: disable=global-statement
43-
print("Shutting down pool at exit")
4443
with _pool_lock:
4544
if _pool is not None:
4645
try:
47-
print("Before shutdown")
4846
_pool.shutdown(wait=True, cancel_futures=True)
49-
print("After shutdown")
5047
except Exception as e:
5148
_logger.error(
5249
"Error during ProcessPoolExecutor shutdown at exit: %s",

python/cocoindex/tests/conftest.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,12 @@ def _cocoindex_windows_env_fixture(
1111
) -> typing.Generator[None, None, None]:
1212
"""Shutdown the subprocess pool at exit on Windows."""
1313

14-
print("Platform: ", sys.platform)
15-
1614
yield
1715

18-
print("Test done.")
19-
sys.stdout.flush()
2016
if not sys.platform.startswith("win"):
2117
return
2218

2319
try:
24-
print("Shutdown the subprocess pool at exit in hook.")
25-
sys.stdout.flush()
26-
2720
import cocoindex.subprocess_exec
2821

2922
original_sigint_handler = signal.getsignal(signal.SIGINT)
@@ -33,10 +26,7 @@ def _cocoindex_windows_env_fixture(
3326

3427
# If any test failed, let pytest exit normally with nonzero code
3528
if request.session.testsfailed == 0:
36-
print("Exit with success.")
37-
sys.stdout.flush()
38-
39-
sys.exit(0)
29+
os._exit(0) # immediate success exit (skips atexit/teardown)
4030

4131
finally:
4232
try:

0 commit comments

Comments
 (0)