Skip to content

Commit b8ea875

Browse files
committed
add test for unpatching more times than patching raising warning
1 parent 54fa129 commit b8ea875

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mkl_random/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_random
2930
import mkl_random.interfaces.numpy_random as _nrand
@@ -103,3 +104,10 @@ def test_patch_reentrant():
103104
finally:
104105
while mkl_random.is_patched():
105106
mkl_random.restore_numpy_random()
107+
108+
109+
def test_patch_warning():
110+
if mkl_random.is_patched():
111+
pytest.skip("This test should not be run with a pre-patched NumPy.")
112+
with pytest.warns(RuntimeWarning, match="restore_numpy_random*"):
113+
mkl_random.restore_numpy_random()

0 commit comments

Comments
 (0)