diff --git a/pyproject.toml b/pyproject.toml index 116a646276..574b09b076 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -153,7 +153,7 @@ run-coverage-gpu = "pip install cupy-cuda12x && pytest -m gpu --cov-config=pypro run = "run-coverage --no-cov" run-verbose = "run-coverage --verbose" run-mypy = "mypy src" -run-hypothesis = "pytest --hypothesis-profile ci tests/v3/test_properties.py tests/v3/test_store/test_stateful*" +run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*" list-env = "pip list" [tool.hatch.envs.gputest] @@ -173,7 +173,7 @@ run-coverage = "pytest -m gpu --cov-config=pyproject.toml --cov=pkg --cov=tests" run = "run-coverage --no-cov" run-verbose = "run-coverage --verbose" run-mypy = "mypy src" -run-hypothesis = "pytest --hypothesis-profile ci tests/v3/test_properties.py tests/v3/test_store/test_stateful*" +run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*" list-env = "pip list" [tool.hatch.envs.docs] @@ -282,18 +282,17 @@ ignore_errors = true [[tool.mypy.overrides]] module = [ - "tests.v2.*", - "tests.v3.package_with_entrypoint.*", - "tests.v3.test_codecs.test_codecs", - "tests.v3.test_codecs.test_transpose", - "tests.v3.test_metadata.*", - "tests.v3.test_store.*", - "tests.v3.test_config", - "tests.v3.test_group", - "tests.v3.test_indexing", - "tests.v3.test_properties", - "tests.v3.test_sync", - "tests.v3.test_v2", + "tests.package_with_entrypoint.*", + "tests.test_codecs.test_codecs", + "tests.test_codecs.test_transpose", + "tests.test_metadata.*", + "tests.test_store.*", + "tests.test_config", + "tests.test_group", + "tests.test_indexing", + "tests.test_properties", + "tests.test_sync", + "tests.test_v2", ] ignore_errors = true diff --git a/src/zarr/testing/utils.py b/src/zarr/testing/utils.py index 9d6dfa7e18..c7b6e7939c 100644 --- a/src/zarr/testing/utils.py +++ b/src/zarr/testing/utils.py @@ -1,6 +1,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, cast +from collections.abc import Callable, Coroutine +from typing import TYPE_CHECKING, Any, TypeVar, cast import pytest @@ -37,8 +38,16 @@ def has_cupy() -> bool: return False +T_Callable = TypeVar("T_Callable", bound=Callable[[], Coroutine[Any, Any, None]]) + + # Decorator for GPU tests -def gpu_test(func: Any) -> Any: - return pytest.mark.gpu( - pytest.mark.skipif(not has_cupy(), reason="CuPy not installed or no GPU available")(func) +def gpu_test(func: T_Callable) -> T_Callable: + return cast( + T_Callable, + pytest.mark.gpu( + pytest.mark.skipif(not has_cupy(), reason="CuPy not installed or no GPU available")( + func + ) + ), ) diff --git a/tests/v3/conftest.py b/tests/conftest.py similarity index 100% rename from tests/v3/conftest.py rename to tests/conftest.py diff --git a/tests/v3/package_with_entrypoint-0.1.dist-info/entry_points.txt b/tests/package_with_entrypoint-0.1.dist-info/entry_points.txt similarity index 100% rename from tests/v3/package_with_entrypoint-0.1.dist-info/entry_points.txt rename to tests/package_with_entrypoint-0.1.dist-info/entry_points.txt diff --git a/tests/v3/package_with_entrypoint/__init__.py b/tests/package_with_entrypoint/__init__.py similarity index 100% rename from tests/v3/package_with_entrypoint/__init__.py rename to tests/package_with_entrypoint/__init__.py diff --git a/tests/v3/test_api.py b/tests/test_api.py similarity index 100% rename from tests/v3/test_api.py rename to tests/test_api.py diff --git a/tests/v3/test_array.py b/tests/test_array.py similarity index 100% rename from tests/v3/test_array.py rename to tests/test_array.py diff --git a/tests/v3/test_attributes.py b/tests/test_attributes.py similarity index 100% rename from tests/v3/test_attributes.py rename to tests/test_attributes.py diff --git a/tests/v3/test_buffer.py b/tests/test_buffer.py similarity index 100% rename from tests/v3/test_buffer.py rename to tests/test_buffer.py diff --git a/tests/v3/test_chunk_grids.py b/tests/test_chunk_grids.py similarity index 100% rename from tests/v3/test_chunk_grids.py rename to tests/test_chunk_grids.py diff --git a/tests/v3/test_codec_entrypoints.py b/tests/test_codec_entrypoints.py similarity index 100% rename from tests/v3/test_codec_entrypoints.py rename to tests/test_codec_entrypoints.py diff --git a/tests/v3/__init__.py b/tests/test_codecs/__init__.py similarity index 100% rename from tests/v3/__init__.py rename to tests/test_codecs/__init__.py diff --git a/tests/v3/test_codecs/test_blosc.py b/tests/test_codecs/test_blosc.py similarity index 100% rename from tests/v3/test_codecs/test_blosc.py rename to tests/test_codecs/test_blosc.py diff --git a/tests/v3/test_codecs/test_codecs.py b/tests/test_codecs/test_codecs.py similarity index 100% rename from tests/v3/test_codecs/test_codecs.py rename to tests/test_codecs/test_codecs.py diff --git a/tests/v3/test_codecs/test_endian.py b/tests/test_codecs/test_endian.py similarity index 100% rename from tests/v3/test_codecs/test_endian.py rename to tests/test_codecs/test_endian.py diff --git a/tests/v3/test_codecs/test_gzip.py b/tests/test_codecs/test_gzip.py similarity index 100% rename from tests/v3/test_codecs/test_gzip.py rename to tests/test_codecs/test_gzip.py diff --git a/tests/v3/test_codecs/test_sharding.py b/tests/test_codecs/test_sharding.py similarity index 100% rename from tests/v3/test_codecs/test_sharding.py rename to tests/test_codecs/test_sharding.py diff --git a/tests/v3/test_codecs/test_transpose.py b/tests/test_codecs/test_transpose.py similarity index 100% rename from tests/v3/test_codecs/test_transpose.py rename to tests/test_codecs/test_transpose.py diff --git a/tests/v3/test_codecs/test_vlen.py b/tests/test_codecs/test_vlen.py similarity index 100% rename from tests/v3/test_codecs/test_vlen.py rename to tests/test_codecs/test_vlen.py diff --git a/tests/v3/test_codecs/test_zstd.py b/tests/test_codecs/test_zstd.py similarity index 100% rename from tests/v3/test_codecs/test_zstd.py rename to tests/test_codecs/test_zstd.py diff --git a/tests/v3/test_common.py b/tests/test_common.py similarity index 100% rename from tests/v3/test_common.py rename to tests/test_common.py diff --git a/tests/v3/test_config.py b/tests/test_config.py similarity index 98% rename from tests/v3/test_config.py rename to tests/test_config.py index 62907588c7..c4cf794c5f 100644 --- a/tests/v3/test_config.py +++ b/tests/test_config.py @@ -87,7 +87,7 @@ class MockClass: assert ( fully_qualified_name(MockClass) - == "tests.v3.test_config.test_fully_qualified_name..MockClass" + == "tests.test_config.test_fully_qualified_name..MockClass" ) diff --git a/tests/v3/test_group.py b/tests/test_group.py similarity index 100% rename from tests/v3/test_group.py rename to tests/test_group.py diff --git a/tests/v3/test_indexing.py b/tests/test_indexing.py similarity index 100% rename from tests/v3/test_indexing.py rename to tests/test_indexing.py diff --git a/tests/v3/test_codecs/__init__.py b/tests/test_metadata/__init__.py similarity index 100% rename from tests/v3/test_codecs/__init__.py rename to tests/test_metadata/__init__.py diff --git a/tests/v3/test_metadata/test_consolidated.py b/tests/test_metadata/test_consolidated.py similarity index 100% rename from tests/v3/test_metadata/test_consolidated.py rename to tests/test_metadata/test_consolidated.py diff --git a/tests/v3/test_metadata/test_v2.py b/tests/test_metadata/test_v2.py similarity index 100% rename from tests/v3/test_metadata/test_v2.py rename to tests/test_metadata/test_v2.py diff --git a/tests/v3/test_metadata/test_v3.py b/tests/test_metadata/test_v3.py similarity index 100% rename from tests/v3/test_metadata/test_v3.py rename to tests/test_metadata/test_v3.py diff --git a/tests/v3/test_properties.py b/tests/test_properties.py similarity index 100% rename from tests/v3/test_properties.py rename to tests/test_properties.py diff --git a/tests/v3/test_metadata/__init__.py b/tests/test_store/__init__.py similarity index 100% rename from tests/v3/test_metadata/__init__.py rename to tests/test_store/__init__.py diff --git a/tests/v3/test_store/test_core.py b/tests/test_store/test_core.py similarity index 100% rename from tests/v3/test_store/test_core.py rename to tests/test_store/test_core.py diff --git a/tests/v3/test_store/test_local.py b/tests/test_store/test_local.py similarity index 100% rename from tests/v3/test_store/test_local.py rename to tests/test_store/test_local.py diff --git a/tests/v3/test_store/test_logging.py b/tests/test_store/test_logging.py similarity index 100% rename from tests/v3/test_store/test_logging.py rename to tests/test_store/test_logging.py diff --git a/tests/v3/test_store/test_memory.py b/tests/test_store/test_memory.py similarity index 100% rename from tests/v3/test_store/test_memory.py rename to tests/test_store/test_memory.py diff --git a/tests/v3/test_store/test_remote.py b/tests/test_store/test_remote.py similarity index 100% rename from tests/v3/test_store/test_remote.py rename to tests/test_store/test_remote.py diff --git a/tests/v3/test_store/test_stateful_store.py b/tests/test_store/test_stateful_store.py similarity index 100% rename from tests/v3/test_store/test_stateful_store.py rename to tests/test_store/test_stateful_store.py diff --git a/tests/v3/test_store/test_zip.py b/tests/test_store/test_zip.py similarity index 100% rename from tests/v3/test_store/test_zip.py rename to tests/test_store/test_zip.py diff --git a/tests/v3/test_sync.py b/tests/test_sync.py similarity index 100% rename from tests/v3/test_sync.py rename to tests/test_sync.py diff --git a/tests/v3/test_v2.py b/tests/test_v2.py similarity index 100% rename from tests/v3/test_v2.py rename to tests/test_v2.py diff --git a/tests/v3/test_store/__init__.py b/tests/v3/test_store/__init__.py deleted file mode 100644 index e69de29bb2..0000000000