diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 22437d05c7..88fc6ff7e6 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -66,7 +66,7 @@ jobs: source .venv-pyodide/bin/activate python -m pip install dist/*.whl python -m pip install pytest pytest-cov - python -m pytest -v --cov=zarr --cov-config=pyproject.toml zarr + python -m pytest -v --cov=zarr --cov-config=pyproject.toml - name: Upload Pyodide wheel artifact for debugging # FIXME: Remove after this is ready to merge diff --git a/pyproject.toml b/pyproject.toml index e7e89c5670..da57fdbea6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -249,7 +249,7 @@ minversion = "7" testpaths = ["tests"] log_cli_level = "INFO" xfail_strict = true -asyncio_mode = "auto" +# asyncio_mode = "auto" doctest_optionflags = [ "NORMALIZE_WHITESPACE", "ELLIPSIS", diff --git a/tests/v3/_shared.py b/tests/v3/_shared.py new file mode 100644 index 0000000000..d853a02675 --- /dev/null +++ b/tests/v3/_shared.py @@ -0,0 +1,16 @@ +# A common file that can be used to add constants, functions, +# convenience classes, etc. that are shared across multiple tests + +import platform +import sys + +import pytest + +IS_WASM = sys.platform == "emscripten" or platform.machine() in ["wasm32", "wasm64"] + + +def asyncio_tests_wrapper(func): + if IS_WASM: + return func + else: + return pytest.mark.asyncio(func) diff --git a/tests/v3/test_buffer.py b/tests/v3/test_buffer.py index 2f58d116fe..07ef96bf6e 100644 --- a/tests/v3/test_buffer.py +++ b/tests/v3/test_buffer.py @@ -5,11 +5,12 @@ import numpy as np import numpy.typing as npt -import pytest from zarr.array import AsyncArray from zarr.buffer import ArrayLike, NDArrayLike, NDBuffer +from ._shared import asyncio_tests_wrapper + if TYPE_CHECKING: from typing_extensions import Self @@ -45,7 +46,7 @@ def test_nd_array_like(xp): assert isinstance(ary, NDArrayLike) -@pytest.mark.asyncio +@asyncio_tests_wrapper async def test_async_array_factory(store_path): expect = np.zeros((9, 9), dtype="uint16", order="F") a = await AsyncArray.create(