diff --git a/pyproject.toml b/pyproject.toml index 93ef8c5e4b..fa049649b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -141,6 +141,8 @@ exclude_also = [ ] [tool.coverage.run] +parallel = true +source = ["src"] omit = [ "bench/compress_normal.py", "src/zarr/testing/conftest.py", # only for downstream projects @@ -156,6 +158,7 @@ hooks.vcs.version-file = "src/zarr/_version.py" dependency-groups = ["test"] [tool.hatch.envs.test.env-vars] +COVERAGE_PROCESS_START = "pyproject.toml" [[tool.hatch.envs.test.matrix]] python = ["3.12", "3.13", "3.14"] @@ -173,18 +176,21 @@ matrix.deps.dependency-groups = [ [tool.hatch.envs.test.scripts] run-coverage = [ - "coverage run --source=src -m pytest --ignore tests/benchmarks --junitxml=junit.xml -o junit_family=legacy {args:}", + "coverage run -m pytest -n auto --dist loadgroup --ignore tests/benchmarks --junitxml=junit.xml -o junit_family=legacy {args:}", + "coverage combine", "coverage xml", ] run-coverage-html = [ - "coverage run --source=src -m pytest --ignore tests/benchmarks {args:}", + "coverage run -m pytest -n auto --dist loadgroup --ignore tests/benchmarks {args:}", + "coverage combine", "coverage html", ] -run = "pytest --ignore tests/benchmarks" +run = "pytest -n auto --dist loadgroup --ignore tests/benchmarks {args:}" run-verbose = "run-coverage --verbose" run-mypy = "mypy src" run-hypothesis = [ - "coverage run --source=src -m pytest -nauto --run-slow-hypothesis tests/test_properties.py tests/test_store/test_stateful* {args:}", + "coverage run -m pytest -nauto --dist loadgroup --run-slow-hypothesis tests/test_properties.py tests/test_store/test_stateful* {args:}", + "coverage combine", "coverage xml", ] run-benchmark = "pytest --benchmark-enable tests/benchmarks" @@ -203,7 +209,8 @@ python = ["3.12", "3.13"] [tool.hatch.envs.gputest.scripts] run-coverage = [ - "coverage run --source=src -m pytest -m gpu --junitxml=junit.xml -o junit_family=legacy --ignore tests/benchmarks {args:}", + "coverage run -m pytest -m gpu --junitxml=junit.xml -o junit_family=legacy --ignore tests/benchmarks {args:}", + "coverage combine", "coverage xml", ] run = "pytest -m gpu --ignore tests/benchmarks" diff --git a/tests/test_api/test_synchronous.py b/tests/test_api/test_synchronous.py index d6ae61f1ca..1d5374aab3 100644 --- a/tests/test_api/test_synchronous.py +++ b/tests/test_api/test_synchronous.py @@ -93,7 +93,7 @@ def test_docstrings_match(callable_name: str) -> None: ), ), ], - ids=str, + ids=["store_path-create_array_group", "store_path-create", "array_params-create_array_dataset"], ) def test_docstring_consistent_parameters( parameter_name: str, array_creation_routines: tuple[Callable[[Any], Any], ...] diff --git a/tests/test_store/test_fsspec.py b/tests/test_store/test_fsspec.py index 5e9e33f0e4..51276045f7 100644 --- a/tests/test_store/test_fsspec.py +++ b/tests/test_store/test_fsspec.py @@ -44,6 +44,9 @@ pytest.mark.filterwarnings( "ignore:Exception ignored in.*finalize object.*:pytest.PytestUnraisableExceptionWarning" ), + # All S3 tests share a module-scoped moto server on a fixed port, + # so they must run on a single xdist worker to avoid port conflicts. + pytest.mark.xdist_group(name="s3"), ] fsspec = pytest.importorskip("fsspec")