Skip to content

Commit 70be10e

Browse files
Use nosetests, aligning with recipe
1 parent 169b988 commit 70be10e

File tree

4 files changed

+48
-8
lines changed

4 files changed

+48
-8
lines changed

.github/workflows/conda-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ jobs:
107107
- name: Install mkl_fft
108108
run: |
109109
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
110-
conda create -n test_mkl_fft python=${{ matrix.python }} "libffi>=3.4" $PACKAGE_NAME pytest $CHANNELS
110+
conda create -n test_mkl_fft python=${{ matrix.python }} $PACKAGE_NAME pytest $CHANNELS
111111
# Test installed packages
112112
conda list -n test_mkl_fft
113113
- name: Run tests
114114
run: |
115115
source $CONDA/etc/profile.d/conda.sh
116116
conda activate test_mkl_fft
117-
python -m pytest --pyargs $MODULE_NAME
117+
pytest -v --pyargs $MODULE_NAME

conda-recipe/meta.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% set version = "1.3.0" %}
2-
{% set buildnumber = 1 %}
1+
{% set version = "1.3.1" %}
2+
{% set buildnumber = 0 %}
33

44
package:
55
name: mkl_fft
@@ -21,7 +21,6 @@ requirements:
2121
- setuptools
2222
- mkl-devel
2323
- cython
24-
- blas=*=mkl
2524
- numpy-base
2625
run:
2726
- python
@@ -31,9 +30,9 @@ requirements:
3130

3231
test:
3332
commands:
34-
- nosetests -v mkl_fft
33+
- pytest -v --args mkl_fft
3534
requires:
36-
- nose
35+
- pytest
3736
imports:
3837
- mkl_fft
3938
- mkl_fft.interface

mkl_fft/_scipy_fft_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def _compute_nd_forward_scale(norm, s, axes, x_shape):
204204
elif norm == "forward":
205205
fsc = _frwd_sc_nd(s, axes, x_shape)
206206
elif norm == "ortho":
207-
fsc = sqrt(_frwd_sc_nd(s, axes, x-shape))
207+
fsc = sqrt(_frwd_sc_nd(s, axes, x_shape))
208208
else:
209209
_check_norm(norm)
210210
return fsc

mkl_fft/tests/test_interfaces.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import mkl_fft.interfaces as mfi
2828
import pytest
29+
import numpy as np
2930

3031

3132
def test_interfaces_has_numpy():
@@ -34,3 +35,43 @@ def test_interfaces_has_numpy():
3435

3536
def test_interfaces_has_scipy():
3637
assert hasattr(mfi, 'scipy_fft')
38+
39+
40+
@pytest.mark.parametrize('norm', [None, "forward", "backward", "ortho"])
41+
@pytest.mark.parametrize('dtype', [np.float32, np.float64, np.complex64, np.complex128])
42+
def test_scipy_fft(norm, dtype):
43+
x = np.ones(511, dtype=dtype)
44+
w = mfi.scipy_fft.fft(x, norm=norm)
45+
xx = mfi.scipy_fft.ifft(w, norm=norm)
46+
tol = 64 * np.finfo(np.dtype(dtype)).eps
47+
assert np.allclose(x, xx, atol=tol, rtol=tol)
48+
49+
50+
@pytest.mark.parametrize('norm', [None, "forward", "backward", "ortho"])
51+
@pytest.mark.parametrize('dtype', [np.float32, np.float64])
52+
def test_scipy_rfft(norm, dtype):
53+
x = np.ones(511, dtype=dtype)
54+
w = mfi.scipy_fft.rfft(x, norm=norm)
55+
xx = mfi.scipy_fft.irfft(w, n=x.shape[0], norm=norm)
56+
tol = 64 * np.finfo(np.dtype(dtype)).eps
57+
assert np.allclose(x, xx, atol=tol, rtol=tol)
58+
59+
60+
@pytest.mark.parametrize('norm', [None, "forward", "backward", "ortho"])
61+
@pytest.mark.parametrize('dtype', [np.float32, np.float64, np.complex64, np.complex128])
62+
def test_scipy_fftn(norm, dtype):
63+
x = np.ones((37, 83), dtype=dtype)
64+
w = mfi.scipy_fft.fftn(x, norm=norm)
65+
xx = mfi.scipy_fft.ifftn(w, norm=norm)
66+
tol = 64 * np.finfo(np.dtype(dtype)).eps
67+
assert np.allclose(x, xx, atol=tol, rtol=tol)
68+
69+
70+
@pytest.mark.parametrize('norm', [None, "forward", "backward", "ortho"])
71+
@pytest.mark.parametrize('dtype', [np.float32, np.float64])
72+
def test_scipy_rftn(norm, dtype):
73+
x = np.ones((37, 83), dtype=dtype)
74+
w = mfi.scipy_fft.rfftn(x, norm=norm)
75+
xx = mfi.scipy_fft.ifftn(w, s=x.shape, norm=norm)
76+
tol = 64 * np.finfo(np.dtype(dtype)).eps
77+
assert np.allclose(x, xx, atol=tol, rtol=tol)

0 commit comments

Comments
 (0)