Skip to content

Commit 042e49f

Browse files
committed
skip patch test if NumPy fft has been replaced by a module already
1 parent b5a4b19 commit 042e49f

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

mkl_fft/tests/test_patch.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,25 @@
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
3031

3132

33+
@pytest.mark.skipif(
34+
np.fft.fft.__module__ != "numpy.fft",
35+
reason="NumPy is already patched by a different library",
36+
)
3237
def test_patch():
3338
mkl_fft.restore_numpy_fft()
3439
assert not mkl_fft.is_patched()
35-
assert (np.fft.fft.__module__ == "numpy.fft")
40+
assert np.fft.fft.__module__ == "numpy.fft"
3641

3742
mkl_fft.patch_numpy_fft() # Enable mkl_fft in Numpy
3843
assert mkl_fft.is_patched()
39-
assert (np.fft.fft.__module__ == _nfft.fft.__module__)
44+
assert np.fft.fft.__module__ == _nfft.fft.__module__
4045

4146
mkl_fft.restore_numpy_fft() # Disable mkl_fft in Numpy
4247
assert not mkl_fft.is_patched()
43-
assert (np.fft.fft.__module__ == "numpy.fft")
48+
assert np.fft.fft.__module__ == "numpy.fft"

0 commit comments

Comments
 (0)