Skip to content

Commit 0d5987b

Browse files
committed
add test for warning when restoring more times than patching
1 parent 8c3c77d commit 0d5987b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

mkl_fft/tests/test_patch.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525

2626
import numpy as np
27+
import pytest
2728

2829
import mkl_fft
2930
import mkl_fft.interfaces.numpy_fft as _nfft
@@ -78,3 +79,10 @@ def test_patch_reentrant():
7879

7980
assert not mkl_fft.is_patched()
8081
assert np.fft.fft.__module__ == old_module
82+
83+
84+
def test_patch_warning():
85+
if mkl_fft.is_patched():
86+
pytest.skip("This test should not be run with a pre-patched NumPy.")
87+
with pytest.warns(RuntimeWarning, match="restore_numpy_fft*"):
88+
mkl_fft.restore_numpy_fft()

0 commit comments

Comments
 (0)