From d3271bc79897ae7cfdacf6472e1466436923ae41 Mon Sep 17 00:00:00 2001 From: Lars Bogner Date: Mon, 10 Aug 2026 09:48:58 +0200 Subject: [PATCH] Silence the fork-safety warning from num_workers>0 pipeline tests The two DataLoader-num_workers quota tests are the only ones in the file that leave num_workers>0, so they're the only ones that actually spawn forked worker subprocesses under pytest's multi-threaded process and hit Python's fork-safety DeprecationWarning. The thing under test is just the pre-flight quota-check message, emitted before the DataLoader is built. Co-Authored-By: Claude Sonnet 5 --- tests/test_pipeline.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index f85beca..f202b9d 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -186,14 +186,19 @@ def test_run_train_job_no_topn_map_for_physical_target(tmp_path, data): assert loaded.topn_maps == {} +@pytest.mark.filterwarnings("ignore::DeprecationWarning:multiprocessing.popen_fork") def test_run_train_job_warns_when_num_workers_exceeds_shared_quota( tmp_path, data, monkeypatch ): + # num_workers>0 makes DataLoader actually fork worker subprocesses + # (unlike every other test here, which runs with num_workers=0) — pytest + # itself is multi-threaded, hence Python's fork-safety warning below. monkeypatch.setattr("giant.pipeline.os.cpu_count", lambda: 8) # quota = 2 echo = _run(data, tmp_path / "out", num_workers=3) assert any("num-workers=3" in m and "exceeds" in m for m in echo) +@pytest.mark.filterwarnings("ignore::DeprecationWarning:multiprocessing.popen_fork") def test_run_train_job_no_warning_when_num_workers_within_shared_quota( tmp_path, data, monkeypatch ):