diff --git a/src/depiction/misc/integration_test_utils.py b/src/depiction/misc/integration_test_utils.py index 5b7e2eb..14fbd52 100644 --- a/src/depiction/misc/integration_test_utils.py +++ b/src/depiction/misc/integration_test_utils.py @@ -1,4 +1,3 @@ -import warnings from typing import Optional from numpy.typing import ArrayLike @@ -20,12 +19,3 @@ def populate_test_file( with ImzmlWriteFile(path, imzml_mode).writer() as writer: for mz_arr, int_arr, coordinates in zip(mz_arr_list, int_arr_list, coordinates_list): writer.add_spectrum(mz_arr, int_arr, coordinates) - - @staticmethod - def treat_warnings_as_error(test_case) -> None: - """To be called from setUp.""" - # TODO reuse or refactor (and move out of integration_test_utils and rather a more general test_utils?) - warnings_ctx = warnings.catch_warnings() - warnings_ctx.__enter__() - warnings.simplefilter("error") - test_case.addCleanup(warnings_ctx.__exit__, None, None, None) diff --git a/tests/unit/image/test_spatial_smoothing_sparse_aware.py b/tests/unit/image/test_spatial_smoothing_sparse_aware.py index 0bb5f0d..22aba68 100644 --- a/tests/unit/image/test_spatial_smoothing_sparse_aware.py +++ b/tests/unit/image/test_spatial_smoothing_sparse_aware.py @@ -1,4 +1,5 @@ import unittest +import warnings from datetime import timedelta from functools import cached_property @@ -8,7 +9,15 @@ from xarray import DataArray from depiction.image.spatial_smoothing_sparse_aware import SpatialSmoothingSparseAware -from depiction.misc.integration_test_utils import IntegrationTestUtils + + +def _treat_warnings_as_error(test_case) -> None: + """To be called from setUp.""" + # TODO reuse or refactor (and move out of integration_test_utils and rather a more general test_utils?) + warnings_ctx = warnings.catch_warnings() + warnings_ctx.__enter__() + warnings.simplefilter("error") + test_case.addCleanup(warnings_ctx.__exit__, None, None, None) class TestSpatialSmoothingSparseAware(unittest.TestCase): @@ -16,7 +25,7 @@ def setUp(self) -> None: self.mock_kernel_size = 5 self.mock_kernel_std = 1.0 self.mock_use_interpolation = False - IntegrationTestUtils.treat_warnings_as_error(self) + _treat_warnings_as_error(self) @cached_property def mock_smooth(self) -> SpatialSmoothingSparseAware: