diff --git a/Makefile b/Makefile index b5aebb53b5..ac97179a81 100644 --- a/Makefile +++ b/Makefile @@ -133,13 +133,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::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" + 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 and not docker and not remote" && 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::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" + pytest -n auto -m "(fast or slow) and not cicdonly and not isolated" && pytest -m "isolated and not fork_isolated and not docker and not remote" && 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::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" + 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 and not docker and not remote" && 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/tests/conftest.py b/tests/conftest.py index 1f7f6d9325..c088bf089b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -211,9 +211,24 @@ def pytest_collection_modifyitems(items, *args, **kwargs): "registry_isolation", "dialect_isolated", } + + # These are built in Pytest fixtures that capture output as documented here: https://docs.pytest.org/en/stable/reference/fixtures.html + # Due to the use of the clear() functionality within the test suite, tests that use these fixtures can collide with each other by + # clearing each others captured outputs, so the these are marked as isolated. + non_thread_safe_fixtures = frozenset( + { + "caplog", + "capsys", + "capsysbinary", + "capfd", + "capfdbinary", + "capteesys", + } + ) + for item in items: - if "capsys" in item.fixturenames: - # capsys is not threadsafe, so the test must be isolated. + if bool(non_thread_safe_fixtures & set(item.fixturenames)): + # Ensure that any tests using non-threadsafe fixtures are isolated. item.add_marker("isolated") for marker in item.iter_markers(): if marker.name in test_type_markers: diff --git a/tests/utils/test_concurrency.py b/tests/utils/test_concurrency.py index 0d45a375f1..04f9748fd7 100644 --- a/tests/utils/test_concurrency.py +++ b/tests/utils/test_concurrency.py @@ -168,7 +168,7 @@ def _run_bounded_python(program: str) -> None: env=env, capture_output=True, text=True, - timeout=8, + timeout=16, ) assert result.returncode == 0, f"{result.stdout}\n{result.stderr}"