Skip to content

Commit

Permalink
TST: fix test condition for Pyodide
Browse files Browse the repository at this point in the history
  • Loading branch information
rgommers committed Feb 21, 2024
1 parent bc67ce7 commit 3b743b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 6 additions & 1 deletion pywt/_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
futures_available = True
# Check if running on Emscripten/WASM, and skip tests that require concurrency.
# Relevant issue: https://github.com/pyodide/pyodide/issues/237
# FIXME: you can't do `except a_bool`
except (sys.platform == "emscripten") or (platform.machine() in ["wasm32", "wasm64"]):
futures_available = False
futures = None
Expand All @@ -34,6 +35,9 @@
max_workers = 1


IS_WASM = (sys.platform == "emscripten") or (platform.machine() in ["wasm32", "wasm64"])


# check if pymatbridge + MATLAB tests should be run
matlab_result_dict_dwt = None
matlab_result_dict_cwt = None
Expand Down Expand Up @@ -63,7 +67,8 @@
matlab_result_dict_dwt = np.load(matlab_data_file_dwt)

uses_futures = pytest.mark.skipif(
not futures_available, reason='futures not available')
True, reason='futures not available')
#not futures_available, reason='futures not available')
uses_matlab = pytest.mark.skipif(
matlab_missing, reason='pymatbridge and/or Matlab not available')
uses_pymatbridge = pytest.mark.skipif(
Expand Down
12 changes: 7 additions & 5 deletions pywt/tests/test_concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import warnings
import numpy as np
from functools import partial

import pytest
from numpy.testing import assert_array_equal, assert_allclose
from pywt._pytest import uses_futures, futures, max_workers

from pywt._pytest import IS_WASM, futures, max_workers
import pywt


Expand All @@ -32,7 +34,7 @@ def _assert_all_coeffs_equal(coefs1, coefs2):
return True


@uses_futures
@pytest.mark.skipif(IS_WASM, reason="no futures support in Pyodide")
def test_concurrent_swt():
# tests error-free concurrent operation (see gh-288)
# swt on 1D data calls the Cython swt
Expand All @@ -53,7 +55,7 @@ def test_concurrent_swt():
_assert_all_coeffs_equal(expected_result, results[-1])


@uses_futures
@pytest.mark.skipif(IS_WASM, reason="no futures support in Pyodide")
def test_concurrent_wavedec():
# wavedec on 1D data calls the Cython dwt_single
# other cases call dwt_axis
Expand All @@ -70,7 +72,7 @@ def test_concurrent_wavedec():
_assert_all_coeffs_equal(expected_result, results[-1])


@uses_futures
@pytest.mark.skipif(IS_WASM, reason="no futures support in Pyodide")
def test_concurrent_dwt():
# dwt on 1D data calls the Cython dwt_single
# other cases call dwt_axis
Expand All @@ -87,7 +89,7 @@ def test_concurrent_dwt():
_assert_all_coeffs_equal([expected_result, ], [results[-1], ])


@uses_futures
@pytest.mark.skipif(IS_WASM, reason="no futures support in Pyodide")
def test_concurrent_cwt():
atol = rtol = 1e-14
time, sst = pywt.data.nino()
Expand Down

0 comments on commit 3b743b5

Please sign in to comment.