Skip to content

Commit a75add9

Browse files
authored
test: ignore Python 3.15 fork-with-threads DeprecationWarning in test_multiprocessing (#4143)
Python 3.15 makes os.fork() emit a DeprecationWarning when the process has multiple threads (python/cpython#84559). zarr's sync event-loop thread is always running by the time test_multiprocessing forks, and the suite runs with filterwarnings = ["error"], so the fork parametrizations fail on 3.15. Fork-safety despite those threads is exactly what this test pins down (zarr registers an os.register_at_fork handler), so keep the coverage and ignore the warning with a targeted per-param filter. Fixes #4086 Assisted-by: ClaudeCode:claude-fable-5
1 parent fe50301 commit a75add9

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

changes/4086.misc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix `test_multiprocessing[fork]` failing on Python 3.15, where `os.fork()` in a multi-threaded process emits a `DeprecationWarning` that the test suite promotes to an error.

tests/test_array.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,9 +1903,18 @@ def _index_array(arr: AnyArray, index: Any) -> Any:
19031903
[
19041904
pytest.param(
19051905
"fork",
1906-
marks=pytest.mark.skipif(
1907-
sys.platform in ("win32", "darwin"), reason="fork not supported on Windows or OSX"
1908-
),
1906+
marks=[
1907+
pytest.mark.skipif(
1908+
sys.platform in ("win32", "darwin"),
1909+
reason="fork not supported on Windows or OSX",
1910+
),
1911+
# Python 3.15 deprecates fork() in multi-threaded processes, and zarr's
1912+
# sync event-loop thread is always running here. Fork-safety despite
1913+
# those threads is exactly what this test pins down, so keep running it.
1914+
pytest.mark.filterwarnings(
1915+
r"ignore:This process \(pid=\d+\) is multi-threaded, use of fork\(\):DeprecationWarning"
1916+
),
1917+
],
19091918
),
19101919
"spawn",
19111920
pytest.param(

0 commit comments

Comments
 (0)