Skip to content

Commit c8cb38b

Browse files
Skip entire sync file under WASM, no threading
1 parent 1a64255 commit c8cb38b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

tests/v3/test_sync.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from zarr.sync import SyncError, SyncMixin, _get_lock, _get_loop, sync
99
from zarr.testing.utils import IS_WASM
1010

11+
pytestmark = pytest.mark.skipif(IS_WASM, reason="Can't test async code in WASM")
12+
1113

1214
@pytest.fixture(params=[True, False])
1315
def sync_loop(request) -> asyncio.AbstractEventLoop | None:
@@ -18,7 +20,6 @@ def sync_loop(request) -> asyncio.AbstractEventLoop | None:
1820
return None
1921

2022

21-
@pytest.mark.skipif(IS_WASM, reason="Can't start new threads in WASM")
2223
def test_get_loop() -> None:
2324
# test that calling _get_loop() twice returns the same loop
2425
loop = _get_loop()
@@ -33,22 +34,19 @@ def test_get_lock() -> None:
3334
assert lock is lock2
3435

3536

36-
@pytest.mark.skipif(IS_WASM, reason="Can't test async code in WASM")
3737
def test_sync(sync_loop: asyncio.AbstractEventLoop | None) -> None:
3838
foo = AsyncMock(return_value="foo")
3939
assert sync(foo(), loop=sync_loop) == "foo"
4040
foo.assert_awaited_once()
4141

4242

43-
@pytest.mark.skipif(IS_WASM, reason="Can't test async code in WASM")
4443
def test_sync_raises(sync_loop: asyncio.AbstractEventLoop | None) -> None:
4544
foo = AsyncMock(side_effect=ValueError("foo-bar"))
4645
with pytest.raises(ValueError, match="foo-bar"):
4746
sync(foo(), loop=sync_loop)
4847
foo.assert_awaited_once()
4948

5049

51-
@pytest.mark.skipif(IS_WASM, reason="Can't test async code in WASM")
5250
def test_sync_timeout() -> None:
5351
duration = 0.002
5452

@@ -59,7 +57,6 @@ async def foo() -> None:
5957
sync(foo(), timeout=duration / 2)
6058

6159

62-
@pytest.mark.skipif(IS_WASM, reason="Can't test async code in WASM")
6360
def test_sync_raises_if_no_coroutine(sync_loop: asyncio.AbstractEventLoop | None) -> None:
6461
def foo() -> str:
6562
return "foo"
@@ -68,7 +65,6 @@ def foo() -> str:
6865
sync(foo(), loop=sync_loop)
6966

7067

71-
@pytest.mark.skipif(IS_WASM, reason="Can't start new threads in WASM")
7268
@pytest.mark.filterwarnings("ignore:coroutine.*was never awaited")
7369
def test_sync_raises_if_loop_is_closed() -> None:
7470
loop = _get_loop()
@@ -104,7 +100,6 @@ def test_sync_raises_if_loop_is_invalid_type() -> None:
104100
foo.assert_not_awaited()
105101

106102

107-
@pytest.mark.skipif(IS_WASM, reason="Can't test async code in WASM")
108103
def test_sync_mixin(sync_loop) -> None:
109104
class AsyncFoo:
110105
def __init__(self) -> None:

0 commit comments

Comments
 (0)