Skip to content

Commit cdf0bb2

Browse files
Try to run tests without async
1 parent d465742 commit cdf0bb2

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

.github/workflows/emscripten.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
source .venv-pyodide/bin/activate
6767
python -m pip install dist/*.whl
6868
python -m pip install pytest pytest-cov
69-
python -m pytest -v --cov=zarr --cov-config=pyproject.toml zarr
69+
python -m pytest -v --cov=zarr --cov-config=pyproject.toml
7070
7171
- name: Upload Pyodide wheel artifact for debugging
7272
# FIXME: Remove after this is ready to merge

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ minversion = "7"
249249
testpaths = ["tests"]
250250
log_cli_level = "INFO"
251251
xfail_strict = true
252-
asyncio_mode = "auto"
252+
# asyncio_mode = "auto"
253253
doctest_optionflags = [
254254
"NORMALIZE_WHITESPACE",
255255
"ELLIPSIS",

tests/v3/_shared.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# A common file that can be used to add constants, functions,
2+
# convenience classes, etc. that are shared across multiple tests
3+
4+
import platform
5+
import sys
6+
7+
import pytest
8+
9+
IS_WASM = sys.platform == "emscripten" or platform.machine() in ["wasm32", "wasm64"]
10+
11+
12+
def asyncio_tests_wrapper(func):
13+
if IS_WASM:
14+
return func
15+
else:
16+
return pytest.mark.asyncio(func)

tests/v3/test_buffer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
import numpy as np
77
import numpy.typing as npt
8-
import pytest
98

109
from zarr.array import AsyncArray
1110
from zarr.buffer import ArrayLike, NDArrayLike, NDBuffer
1211

12+
from ._shared import asyncio_tests_wrapper
13+
1314
if TYPE_CHECKING:
1415
from typing_extensions import Self
1516

@@ -45,7 +46,7 @@ def test_nd_array_like(xp):
4546
assert isinstance(ary, NDArrayLike)
4647

4748

48-
@pytest.mark.asyncio
49+
@asyncio_tests_wrapper
4950
async def test_async_array_factory(store_path):
5051
expect = np.zeros((9, 9), dtype="uint16", order="F")
5152
a = await AsyncArray.create(

0 commit comments

Comments
 (0)