Unverified Commit 0d40a52e authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Remove use of pytest in test code (#1188)

parent 107718c8
import math import math
import warnings
import torch import torch
import torchaudio import torchaudio
import torchaudio.functional as F import torchaudio.functional as F
from parameterized import parameterized from parameterized import parameterized
import pytest
import itertools import itertools
from torchaudio_unittest import common_utils from torchaudio_unittest import common_utils
...@@ -33,17 +33,20 @@ class TestSpectrogramFloat64(Spectrogram, common_utils.PytorchTestCase): ...@@ -33,17 +33,20 @@ class TestSpectrogramFloat64(Spectrogram, common_utils.PytorchTestCase):
class TestCreateFBMatrix(common_utils.TorchaudioTestCase): class TestCreateFBMatrix(common_utils.TorchaudioTestCase):
def test_no_warning_high_n_freq(self): def test_no_warning_high_n_freq(self):
with pytest.warns(None) as w: with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
F.create_fb_matrix(288, 0, 8000, 128, 16000) F.create_fb_matrix(288, 0, 8000, 128, 16000)
assert len(w) == 0 assert len(w) == 0
def test_no_warning_low_n_mels(self): def test_no_warning_low_n_mels(self):
with pytest.warns(None) as w: with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
F.create_fb_matrix(201, 0, 8000, 89, 16000) F.create_fb_matrix(201, 0, 8000, 89, 16000)
assert len(w) == 0 assert len(w) == 0
def test_warning(self): def test_warning(self):
with pytest.warns(None) as w: with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
F.create_fb_matrix(201, 0, 8000, 128, 16000) F.create_fb_matrix(201, 0, 8000, 128, 16000)
assert len(w) == 1 assert len(w) == 1
......
...@@ -17,8 +17,6 @@ if LIBROSA_AVAILABLE: ...@@ -17,8 +17,6 @@ if LIBROSA_AVAILABLE:
import librosa import librosa
import scipy import scipy
import pytest
from torchaudio_unittest import common_utils from torchaudio_unittest import common_utils
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment