Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove skipIfNoSoxBackend #1390

Merged
merged 12 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion test/torchaudio_unittest/common_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
skipIfNoModule,
skipIfNoKaldi,
skipIfNoSox,
skipIfNoSoxBackend,
)
from .wav_utils import (
get_wav_data,
Expand Down
7 changes: 3 additions & 4 deletions test/torchaudio_unittest/common_utils/case_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import torch
from torch.testing._internal.common_utils import TestCase as PytorchTestCase
import torchaudio
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is failing simply because this import statement is being removed. This should stay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my bad. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Somehow the style check fails for this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I see. Since now we remove the 'sox' not in torchaudio.list_audio_backends(), torchaudio is no longer used. Yes, this can be finally removed.

from torchaudio._internal.module_utils import (
is_module_available,
is_sox_available,
Expand Down Expand Up @@ -96,8 +95,8 @@ def skipIfNoModule(module, display_name=None):
return unittest.skipIf(not is_module_available(module), f'"{display_name}" is not available')


skipIfNoSoxBackend = unittest.skipIf(
'sox' not in torchaudio.list_audio_backends(), 'Sox backend not available')
skipIfNoCuda = unittest.skipIf(not torch.cuda.is_available(), reason='CUDA not available')
skipIfNoSox = unittest.skipIf(not is_sox_available(), reason='Sox not available')
skipIfNoSox = unittest.skipIf(
not is_sox_available() or
'sox' not in torchaudio.list_audio_backends(), reason='Sox not available')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to update the logic. 'sox' has been removed from the list of backends so 'sox' not in torchaudio.list_audio_backends() is always False.

skipIfNoKaldi = unittest.skipIf(not is_kaldi_available(), reason='Kaldi not available')
2 changes: 1 addition & 1 deletion test/torchaudio_unittest/compliance_kaldi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def first_sample_of_frame(frame, window_size, window_shift, snip_edges):
window[f, s] = wave[s_in_wave]


@common_utils.skipIfNoSoxBackend
@common_utils.skipIfNoSox
class Test_Kaldi(common_utils.TempDirMixin, common_utils.TorchaudioTestCase):
backend = 'sox'

Expand Down
4 changes: 2 additions & 2 deletions test/torchaudio_unittest/functional/sox_compatibility_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import torchaudio.functional as F

from torchaudio_unittest.common_utils import (
skipIfNoSoxBackend,
skipIfNoSox,
skipIfNoExec,
TempDirMixin,
TorchaudioTestCase,
Expand All @@ -14,7 +14,7 @@
)


@skipIfNoSoxBackend
@skipIfNoSox
@skipIfNoExec('sox')
class TestFunctionalFiltering(TempDirMixin, TorchaudioTestCase):
def run_sox_effect(self, input_file, effect):
Expand Down
4 changes: 2 additions & 2 deletions test/torchaudio_unittest/transforms/sox_compatibility_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from parameterized import parameterized

from torchaudio_unittest.common_utils import (
skipIfNoSoxBackend,
skipIfNoSox,
skipIfNoExec,
TempDirMixin,
TorchaudioTestCase,
Expand All @@ -12,7 +12,7 @@
)


@skipIfNoSoxBackend
@skipIfNoSox
@skipIfNoExec('sox')
class TestFunctionalFiltering(TempDirMixin, TorchaudioTestCase):
def run_sox_effect(self, input_file, effect):
Expand Down