diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..e9d42c9 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,10 @@ +import warnings + +import pytest + + +@pytest.fixture() +def treat_warnings_as_error(): + with warnings.catch_warnings(): + warnings.simplefilter("error") + yield diff --git a/tests/unit/spectrum/baseline/test_tophat_baseline.py b/tests/unit/spectrum/baseline/test_tophat_baseline.py index 0df22bd..5cadc9c 100644 --- a/tests/unit/spectrum/baseline/test_tophat_baseline.py +++ b/tests/unit/spectrum/baseline/test_tophat_baseline.py @@ -1,5 +1,3 @@ -import warnings - import numpy as np import pytest @@ -8,7 +6,7 @@ @pytest.fixture(autouse=True) -def mock_environ(monkeypatch): +def mock_environ(monkeypatch, treat_warnings_as_error): monkeypatch.setenv("NUMBA_DEBUGINFO", "1") @@ -27,13 +25,6 @@ def mock_baseline(mock_window_size, mock_window_unit): return TophatBaseline(window_size=mock_window_size, window_unit=mock_window_unit) -@pytest.fixture(autouse=True) -def treat_warnings_as_error(): - with warnings.catch_warnings(): - warnings.simplefilter("error") - yield - - def test_compute_erosion(): x = np.array([10, 20, 30, 40, 50, 60, 70, 80, 90, 100], dtype=float) element_size = 5