From cb737168d935e42d93cf297a9840b64b23515caf Mon Sep 17 00:00:00 2001 From: mday-io Date: Tue, 13 Oct 2026 22:15:45 -0400 Subject: [PATCH 1/2] fix(ci): isolate model-loading fork tests Run fork tests in a fresh pytest process with collection limited to their module. This contains the intermittent baseline Linux worker crash seen after the other isolated tests without changing production multiprocessing behavior. Signed-off-by: mday-io --- Makefile | 6 +++--- pyproject.toml | 1 + tests/test_forking.py | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 6357d06351..948cd27ee7 100644 --- a/Makefile +++ b/Makefile @@ -132,13 +132,13 @@ engine-up: engine-clickhouse-up engine-mssql-up engine-mysql-up engine-postgres- engine-down: engine-clickhouse-down engine-mssql-down engine-mysql-down engine-postgres-down engine-spark-down engine-trino-down fast-test: - pytest -n auto -m "fast and not cicdonly and not isolated" --junitxml=test-results/junit-fast-test.xml && pytest -m "isolated and not slow" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" + pytest -n auto -m "fast and not cicdonly and not isolated" --junitxml=test-results/junit-fast-test.xml && pytest -m "isolated and not slow and not fork_isolated" && pytest tests/test_forking.py -m "isolated and fork_isolated and not slow" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" slow-test: - pytest -n auto -m "(fast or slow) and not cicdonly and not isolated" && pytest -m "isolated" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" + pytest -n auto -m "(fast or slow) and not cicdonly and not isolated" && pytest -m "isolated and not fork_isolated" && pytest tests/test_forking.py -m "isolated and fork_isolated" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" cicd-test: - pytest -n auto -m "(fast or slow) and not pyspark and not isolated" --junitxml=test-results/junit-cicd.xml && pytest -m "pyspark" && pytest -m "isolated and not pyspark" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" + pytest -n auto -m "(fast or slow) and not pyspark and not isolated" --junitxml=test-results/junit-cicd.xml && pytest -m "pyspark" && pytest -m "isolated and not pyspark and not fork_isolated" && pytest tests/test_forking.py -m "isolated and not pyspark and fork_isolated" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" core-fast-test: pytest -n auto -m "fast and not web and not github and not dbt and not jupyter" diff --git a/pyproject.toml b/pyproject.toml index 9b28dc7a08..46ef90b5b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -257,6 +257,7 @@ markers = [ "remote: test that involves interacting with a remote DB", "cicdonly: test that only runs on CI/CD", "isolated: tests that need to run sequentially usually because they use fork", + "fork_isolated: tests that need a fresh pytest process because they use fork", "dialect_isolated: tests that need to run separately due to global dialect overrides", # Test Domain Markers diff --git a/tests/test_forking.py b/tests/test_forking.py index d11379a158..b5f1d4a54a 100644 --- a/tests/test_forking.py +++ b/tests/test_forking.py @@ -6,7 +6,9 @@ import concurrent.futures -pytestmark = pytest.mark.isolated +# Run in a fresh pytest process so these fork tests do not inherit process-local state created +# by earlier test modules. +pytestmark = [pytest.mark.isolated, pytest.mark.fork_isolated] def test_parallel_load(assert_exp_eq, mocker): From ea18db12c6015d9adc76229080de650c16f8a328 Mon Sep 17 00:00:00 2001 From: mday-io Date: Wed, 14 Oct 2026 09:39:03 -0400 Subject: [PATCH 2/2] fix(ci): run each fork test in its own process The whole-file batch still crashes in Python 3.9 after the first test passes. Give each existing fork test a fresh interpreter, preserving marker filters and assertions. Both test nodes passed 30 individual runs on Linux with Python 3.9 and 3.12. Signed-off-by: mday-io --- Makefile | 6 +++--- pyproject.toml | 2 +- tests/test_forking.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 948cd27ee7..43705a99d3 100644 --- a/Makefile +++ b/Makefile @@ -132,13 +132,13 @@ engine-up: engine-clickhouse-up engine-mssql-up engine-mysql-up engine-postgres- engine-down: engine-clickhouse-down engine-mssql-down engine-mysql-down engine-postgres-down engine-spark-down engine-trino-down fast-test: - pytest -n auto -m "fast and not cicdonly and not isolated" --junitxml=test-results/junit-fast-test.xml && pytest -m "isolated and not slow and not fork_isolated" && pytest tests/test_forking.py -m "isolated and fork_isolated and not slow" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" + pytest -n auto -m "fast and not cicdonly and not isolated" --junitxml=test-results/junit-fast-test.xml && pytest -m "isolated and not slow and not fork_isolated" && pytest tests/test_forking.py::test_parallel_load -m "isolated and fork_isolated and not slow" && pytest tests/test_forking.py::test_parallel_load_multi_repo -m "isolated and fork_isolated and not slow" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" slow-test: - pytest -n auto -m "(fast or slow) and not cicdonly and not isolated" && pytest -m "isolated and not fork_isolated" && pytest tests/test_forking.py -m "isolated and fork_isolated" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" + pytest -n auto -m "(fast or slow) and not cicdonly and not isolated" && pytest -m "isolated and not fork_isolated" && pytest tests/test_forking.py::test_parallel_load -m "isolated and fork_isolated" && pytest tests/test_forking.py::test_parallel_load_multi_repo -m "isolated and fork_isolated" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" cicd-test: - pytest -n auto -m "(fast or slow) and not pyspark and not isolated" --junitxml=test-results/junit-cicd.xml && pytest -m "pyspark" && pytest -m "isolated and not pyspark and not fork_isolated" && pytest tests/test_forking.py -m "isolated and not pyspark and fork_isolated" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" + pytest -n auto -m "(fast or slow) and not pyspark and not isolated" --junitxml=test-results/junit-cicd.xml && pytest -m "pyspark" && pytest -m "isolated and not pyspark and not fork_isolated" && pytest tests/test_forking.py::test_parallel_load -m "isolated and not pyspark and fork_isolated" && pytest tests/test_forking.py::test_parallel_load_multi_repo -m "isolated and not pyspark and fork_isolated" && pytest -m "registry_isolation" && pytest -m "dialect_isolated" core-fast-test: pytest -n auto -m "fast and not web and not github and not dbt and not jupyter" diff --git a/pyproject.toml b/pyproject.toml index 46ef90b5b5..378d3ffe43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -257,7 +257,7 @@ markers = [ "remote: test that involves interacting with a remote DB", "cicdonly: test that only runs on CI/CD", "isolated: tests that need to run sequentially usually because they use fork", - "fork_isolated: tests that need a fresh pytest process because they use fork", + "fork_isolated: tests that need their own fresh pytest process because they use fork", "dialect_isolated: tests that need to run separately due to global dialect overrides", # Test Domain Markers diff --git a/tests/test_forking.py b/tests/test_forking.py index b5f1d4a54a..6a6ceeff13 100644 --- a/tests/test_forking.py +++ b/tests/test_forking.py @@ -6,8 +6,8 @@ import concurrent.futures -# Run in a fresh pytest process so these fork tests do not inherit process-local state created -# by earlier test modules. +# Run each fork test in a fresh pytest process to avoid inheriting native process state from +# earlier tests. pytestmark = [pytest.mark.isolated, pytest.mark.fork_isolated]