Skip to content

Commit 30937dd

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

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

mkl_fft/tests/test_patch.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,27 @@
2323
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2424
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525

26+
import pytest
27+
2628
import numpy as np
2729

2830
import mkl_fft
2931
import mkl_fft.interfaces.numpy_fft as _nfft
3032

3133

34+
@pytest.mark.skipif(
35+
np.fft.fft.__module__ != "numpy.fft",
36+
reason="NumPy is already patched by a different library"
37+
)
3238
def test_patch():
3339
mkl_fft.restore_numpy_fft()
3440
assert not mkl_fft.is_patched()
35-
assert (np.fft.fft.__module__ == "numpy.fft")
41+
assert np.fft.fft.__module__ == "numpy.fft"
3642

3743
mkl_fft.patch_numpy_fft() # Enable mkl_fft in Numpy
3844
assert mkl_fft.is_patched()
39-
assert (np.fft.fft.__module__ == _nfft.fft.__module__)
45+
assert np.fft.fft.__module__ == _nfft.fft.__module__
4046

4147
mkl_fft.restore_numpy_fft() # Disable mkl_fft in Numpy
4248
assert not mkl_fft.is_patched()
43-
assert (np.fft.fft.__module__ == "numpy.fft")
49+
assert np.fft.fft.__module__ == "numpy.fft"

0 commit comments

Comments
 (0)