Skip to content

Commit a4e22eb

Browse files
committed
Fix pytest error while building for python3.8
1 parent 0331e3f commit a4e22eb

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ test-requires = ["pytest", "numpy"]
4646
# Don't test Python 3.8 wheels on macOS/arm64
4747
# test-skip="cp38-macosx_*:arm64"
4848
# Don't test Python 3.9 wheels on manylinux_i686
49-
test-skip="pp*-manylinux_i686"
49+
# test-skip="pp*-manylinux_i686"
5050

5151
# Needed for full C++17 support
5252
[tool.cibuildwheel.macos.environment]

tests/test_pitch_shift.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import numpy as np
33

44
def test_mono():
5-
x1 = np.random.rand(1, 44100)
5+
x1 = np.random.normal(0, 0.1, size=(1, 44100)).astype(np.float32)
66

77
ps = m.Signalsmith.Stretch()
88
ps.setTransposeSemitones(12)
@@ -12,7 +12,7 @@ def test_mono():
1212
assert y1.shape == (1, 44100)
1313

1414
def test_stereo():
15-
x1 = np.random.rand(2, 44100)
15+
x1 = np.random.normal(0, 0.1, size=(2, 44100)).astype(np.float32)
1616

1717
ps = m.Signalsmith.Stretch()
1818
ps.setTransposeSemitones(12)
@@ -22,14 +22,14 @@ def test_stereo():
2222
assert y1.shape == (2, 44100)
2323

2424
def test_multichannel():
25-
nChannels = np.random.randint(3, 10)
26-
x1 = np.random.rand(nChannels, 44100)
25+
n_channels = np.random.randint(3, 10)
26+
x1 = np.random.normal(0, 0.1, size=(n_channels, 44100)).astype(np.float32)
2727

2828
ps = m.Signalsmith.Stretch()
2929
ps.setTransposeSemitones(12)
3030

3131
y1 = ps.process(x1)
3232
del ps
3333

34-
assert y1.shape == (nChannels, 44100)
34+
assert y1.shape == (n_channels, 44100)
3535

tests/test_time_stretch.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import numpy as np
33

44
def test_mono_double_length():
5-
x1 = np.random.rand(1,44100)
6-
x2 = np.random.rand(1,22050)
5+
x1 = np.random.normal(0, 0.1, size=(1, 44100)).astype(np.float32)
6+
x2 = np.random.normal(0, 0.1, size=(1, 22050)).astype(np.float32)
77

88
ps = m.Signalsmith.Stretch()
99
ps.setTimeFactor(0.5)
@@ -16,8 +16,8 @@ def test_mono_double_length():
1616
assert y2.shape == (1, 44100)
1717

1818
def test_mono_half_length():
19-
x1 = np.random.rand(1,44100)
20-
x2 = np.random.rand(1,22050)
19+
x1 = np.random.normal(0, 0.1, size=(1, 44100)).astype(np.float32)
20+
x2 = np.random.normal(0, 0.1, size=(1, 22050)).astype(np.float32)
2121

2222
ps = m.Signalsmith.Stretch()
2323
ps.setTimeFactor(2.)
@@ -30,8 +30,8 @@ def test_mono_half_length():
3030
assert y2.shape == (1, 11025)
3131

3232
def test_stereo_double_length():
33-
x1 = np.random.rand(2,44100)
34-
x2 = np.random.rand(2,22050)
33+
x1 = np.random.normal(0, 0.1, size=(2, 44100)).astype(np.float32)
34+
x2 = np.random.normal(0, 0.1, size=(2, 22050)).astype(np.float32)
3535

3636
ps = m.Signalsmith.Stretch()
3737
ps.setTimeFactor(0.5)
@@ -59,8 +59,8 @@ def test_stereo_half_length():
5959

6060
def test_multichannel_double_length():
6161
n_channels = np.random.randint(3, 10)
62-
x1 = np.random.rand(n_channels, 44100)
63-
x2 = np.random.rand(n_channels, 22050)
62+
x1 = np.random.normal(0, 0.1, size=(n_channels, 44100)).astype(np.float32)
63+
x2 = np.random.normal(0, 0.1, size=(n_channels, 22050)).astype(np.float32)
6464

6565
ps = m.Signalsmith.Stretch()
6666
ps.setTimeFactor(0.5)
@@ -74,8 +74,8 @@ def test_multichannel_double_length():
7474

7575
def test_multichannel_half_length():
7676
n_channels = np.random.randint(3, 10)
77-
x1 = np.random.rand(n_channels, 44100)
78-
x2 = np.random.rand(n_channels, 22050)
77+
x1 = np.random.normal(0, 0.1, size=(n_channels, 44100)).astype(np.float32)
78+
x2 = np.random.normal(0, 0.1, size=(n_channels, 22050)).astype(np.float32)
7979

8080
ps = m.Signalsmith.Stretch()
8181
ps.setTimeFactor(2.)

0 commit comments

Comments
 (0)