Skip to content

Commit

Permalink
extract treat_warnigns_as_error fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Sep 30, 2024
1 parent ec4817d commit 9a698b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 10 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import warnings

import pytest


@pytest.fixture()
def treat_warnings_as_error():
with warnings.catch_warnings():
warnings.simplefilter("error")
yield
11 changes: 1 addition & 10 deletions tests/unit/spectrum/baseline/test_tophat_baseline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import warnings

import numpy as np
import pytest

Expand All @@ -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")


Expand All @@ -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
Expand Down

0 comments on commit 9a698b7

Please sign in to comment.