Skip to content

Commit 512c2fa

Browse files
krishnakalyan3krishnakalyan3
andauthored
Remove skipIfNoSoxBackend (#1390)
Co-authored-by: krishnakalyan3 <[email protected]>
1 parent 14dd917 commit 512c2fa

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

test/torchaudio_unittest/common_utils/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
skipIfNoModule,
1818
skipIfNoKaldi,
1919
skipIfNoSox,
20-
skipIfNoSoxBackend,
2120
)
2221
from .wav_utils import (
2322
get_wav_data,

test/torchaudio_unittest/common_utils/case_utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import torch
99
from torch.testing._internal.common_utils import TestCase as PytorchTestCase
10-
import torchaudio
1110
from torchaudio._internal.module_utils import (
1211
is_module_available,
1312
is_sox_available,
@@ -96,8 +95,6 @@ def skipIfNoModule(module, display_name=None):
9695
return unittest.skipIf(not is_module_available(module), f'"{display_name}" is not available')
9796

9897

99-
skipIfNoSoxBackend = unittest.skipIf(
100-
'sox' not in torchaudio.list_audio_backends(), 'Sox backend not available')
10198
skipIfNoCuda = unittest.skipIf(not torch.cuda.is_available(), reason='CUDA not available')
10299
skipIfNoSox = unittest.skipIf(not is_sox_available(), reason='Sox not available')
103100
skipIfNoKaldi = unittest.skipIf(not is_kaldi_available(), reason='Kaldi not available')

test/torchaudio_unittest/compliance_kaldi_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def first_sample_of_frame(frame, window_size, window_shift, snip_edges):
4747

4848
@common_utils.skipIfNoSox
4949
class Test_Kaldi(common_utils.TempDirMixin, common_utils.TorchaudioTestCase):
50-
backend = 'sox_io'
5150

5251
kaldi_output_dir = common_utils.get_asset_path('kaldi')
5352
test_filepath = common_utils.get_asset_path('kaldi_file.wav')
@@ -113,7 +112,7 @@ def _create_data_set(self):
113112
# clear the last 16 bits because they aren't used anyways
114113
y = ((y >> 16) << 16).float()
115114
torchaudio.save(self.test_filepath, y, sr)
116-
sound, sample_rate = torchaudio.load(self.test_filepath, normalization=False)
115+
sound, sample_rate = common_utils.load_wav(self.test_filepath, normalize=False)
117116
print(y >> 16)
118117
self.assertTrue(sample_rate == sr)
119118
self.assertEqual(y, sound)

test/torchaudio_unittest/functional/sox_compatibility_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import torchaudio.functional as F
33

44
from torchaudio_unittest.common_utils import (
5-
skipIfNoSoxBackend,
5+
skipIfNoSox,
66
skipIfNoExec,
77
TempDirMixin,
88
TorchaudioTestCase,
@@ -14,7 +14,7 @@
1414
)
1515

1616

17-
@skipIfNoSoxBackend
17+
@skipIfNoSox
1818
@skipIfNoExec('sox')
1919
class TestFunctionalFiltering(TempDirMixin, TorchaudioTestCase):
2020
def run_sox_effect(self, input_file, effect):

test/torchaudio_unittest/transforms/sox_compatibility_test.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
from parameterized import parameterized
33

44
from torchaudio_unittest.common_utils import (
5-
skipIfNoSoxBackend,
5+
skipIfNoSox,
66
skipIfNoExec,
77
TempDirMixin,
88
TorchaudioTestCase,
99
get_asset_path,
1010
sox_utils,
1111
load_wav,
12+
save_wav,
13+
get_whitenoise,
1214
)
1315

1416

15-
@skipIfNoSoxBackend
17+
@skipIfNoSox
1618
@skipIfNoExec('sox')
1719
class TestFunctionalFiltering(TempDirMixin, TorchaudioTestCase):
1820
def run_sox_effect(self, input_file, effect):
@@ -24,6 +26,14 @@ def assert_sox_effect(self, result, input_path, effects, atol=1e-04, rtol=1e-5):
2426
expected, _ = self.run_sox_effect(input_path, effects)
2527
self.assertEqual(result, expected, atol=atol, rtol=rtol)
2628

29+
def get_whitenoise(self, sample_rate=8000):
30+
noise = get_whitenoise(
31+
sample_rate=sample_rate, duration=3, scale_factor=0.9,
32+
)
33+
path = self.get_temp_path("whitenoise.wav")
34+
save_wav(path, noise, sample_rate)
35+
return noise, path
36+
2737
@parameterized.expand([
2838
('q', 'quarter_sine'),
2939
('h', 'half_sine'),

0 commit comments

Comments
 (0)