Repository: r9y9/nnmnkwii (language: python)

Issue:
Use pytest instead of nose
this is required to run tests on python 3.10


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index d52e5c7..93be966 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -22,9 +22,10 @@ jobs:
             python-version: 3.8
           - os: ubuntu-latest
             python-version: 3.9
-          # TODO: https://github.com/r9y9/nnmnkwii/issues/124
-          # - os: ubuntu-latest
-          #   python-version: '3.10'
+          - os: ubuntu-latest
+            python-version: '3.10'
+          - os: ubuntu-latest
+            python-version: '3.11'
           - os: macos-latest
             python-version: 3.9
           - os: windows-latest
@@ -59,4 +60,4 @@ jobs:
         pysen run lint
     - name: Test
       run: |
-        nosetests --with-coverage --cover-package=nnmnkwii -v -w tests/ -a '!require_local_data,!modspec'
+        pytest --cov=nnmnkwii --cov-report xml -v tests/
diff --git a/nnmnkwii/datasets/cmu_arctic.py b/nnmnkwii/datasets/cmu_arctic.py
index 9be521e..8f169d3 100644
--- a/nnmnkwii/datasets/cmu_arctic.py
+++ b/nnmnkwii/datasets/cmu_arctic.py
@@ -1,5 +1,3 @@
-from __future__ import absolute_import, print_function, with_statement
-
 from os import listdir
 from os.path import isdir, join, splitext
 
diff --git a/nnmnkwii/datasets/ljspeech.py b/nnmnkwii/datasets/ljspeech.py
index 5999770..0deee99 100644
--- a/nnmnkwii/datasets/ljspeech.py
+++ b/nnmnkwii/datasets/ljspeech.py
@@ -1,5 +1,3 @@
-from __future__ import absolute_import, print_function, with_statement
-
 from os.path import exists, join
 
 import numpy as np
diff --git a/nnmnkwii/datasets/vcc2016.py b/nnmnkwii/datasets/vcc2016.py
index d794f00..2cc2950 100644
--- a/nnmnkwii/datasets/vcc2016.py
+++ b/nnmnkwii/datasets/vcc2016.py
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import absolute_import, print_function, with_statement
-
 from os import listdir
 from os.path import isdir, join, splitext
 
diff --git a/nnmnkwii/frontend/__init__.py b/nnmnkwii/frontend/__init__.py
index dbe8efa..bbeca8f 100644
--- a/nnmnkwii/frontend/__init__.py
+++ b/nnmnkwii/frontend/__init__.py
@@ -1,5 +1,3 @@
-from __future__ import absolute_import, division, print_function
-
 NOTE_MAPPING = {
     "A0": 21,
     "Bb0": 22,
diff --git a/nnmnkwii/functions/__init__.py b/nnmnkwii/functions/__init__.py
index e3fc26c..9a56535 100644
--- a/nnmnkwii/functions/__init__.py
+++ b/nnmnkwii/functions/__init__.py
@@ -1,4 +1,3 @@
-# coding: utf-8
 from nnmnkwii.paramgen import *  # noqa
 from nnmnkwii.postfilters import *  # noqa
 from nnmnkwii.preprocessing import *  # noqa
diff --git a/nnmnkwii/metrics/__init__.py b/nnmnkwii/metrics/__init__.py
index 23e7ab3..1ad4407 100644
--- a/nnmnkwii/metrics/__init__.py
+++ b/nnmnkwii/metrics/__init__.py
@@ -1,5 +1,3 @@
-from __future__ import absolute_import, print_function, with_statement
-
 import math
 
 import numpy as np
diff --git a/nnmnkwii/util/linalg.py b/nnmnkwii/util/linalg.py
index f9c9f48..6684d4b 100644
--- a/nnmnkwii/util/linalg.py
+++ b/nnmnkwii/util/linalg.py
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import absolute_import, division, print_function
-
 import numpy as np
 
 from ._linalg import cholesky_inv_banded as _cholesky_inv_banded
diff --git a/perf/autograd_mlpg_perf.py b/perf/autograd_mlpg_perf.py
index 64db738..2f93339 100644
--- a/perf/autograd_mlpg_perf.py
+++ b/perf/autograd_mlpg_perf.py
@@ -1,5 +1,3 @@
-from __future__ import absolute_import, division, print_function
-
 import sys
 import time
 
diff --git a/setup.py b/setup.py
index b2f525d..10598ff 100644
--- a/setup.py
+++ b/setup.py
@@ -159,10 +159,10 @@ def package_files(directory):
     ext_modules=ext_modules,
     cmdclass=cmdclass,
     install_requires=install_requires,
-    tests_require=["nose", "coverage"],
+    tests_require=["pytest", "pytest-cov", "coverage"],
     extras_require={
         "docs": ["numpydoc", "sphinx_rtd_theme"],
-        "test": ["nose", "pyworld", "librosa"],
+        "test": ["pytest", "pytest-cov", "pyworld", "librosa"],
         "lint": [
             "pysen",
             "types-setuptools",


Test patch:
diff --git a/tests/test_autograd.py b/tests/test_autograd.py
index d8b4c76..691872e 100644
--- a/tests/test_autograd.py
+++ b/tests/test_autograd.py
@@ -3,8 +3,6 @@
 from nnmnkwii import autograd as AF
 from nnmnkwii import paramgen as G
 from nnmnkwii.autograd._impl.mlpg import MLPG, UnitVarianceMLPG
-from nnmnkwii.autograd._impl.modspec import ModSpec
-from nose.plugins.attrib import attr
 from torch import nn
 from torch.autograd import gradcheck
 
@@ -220,23 +218,21 @@ def test_mlpg_variance_expand():
         assert np.allclose(y.data.numpy(), y_hat.data.numpy())
 
 
-@attr("modspec")
-def test_modspec_gradcheck():
-    static_dim = 12
-    T = 16
-    torch.manual_seed(1234)
-    n = 16
-    for norm in [None, "ortho"]:
-        inputs = (torch.rand(T, static_dim, requires_grad=True), n, norm)
-        assert gradcheck(ModSpec.apply, inputs, eps=1e-4, atol=1e-4)
-
-
-@attr("modspec")
-def test_modspec_gradcheck_large_n():
-    static_dim = 12
-    T = 16
-    torch.manual_seed(1234)
-    for n in [16, 32]:
-        for norm in [None, "ortho"]:
-            inputs = (torch.rand(T, static_dim, requires_grad=True), n, norm)
-            assert gradcheck(ModSpec.apply, inputs, eps=1e-4, atol=1e-4)
+# def test_modspec_gradcheck():
+#     static_dim = 12
+#     T = 16
+#     torch.manual_seed(1234)
+#     n = 16
+#     for norm in [None, "ortho"]:
+#         inputs = (torch.rand(T, static_dim, requires_grad=True), n, norm)
+#         assert gradcheck(ModSpec.apply, inputs, eps=1e-4, atol=1e-4)
+
+
+# def test_modspec_gradcheck_large_n():
+#     static_dim = 12
+#     T = 16
+#     torch.manual_seed(1234)
+#     for n in [16, 32]:
+#         for norm in [None, "ortho"]:
+#             inputs = (torch.rand(T, static_dim, requires_grad=True), n, norm)
+#             assert gradcheck(ModSpec.apply, inputs, eps=1e-4, atol=1e-4)
diff --git a/tests/test_baseline.py b/tests/test_baseline.py
index 0947771..61b603d 100644
--- a/tests/test_baseline.py
+++ b/tests/test_baseline.py
@@ -1,7 +1,6 @@
 from os.path import dirname, join
 
 import numpy as np
-from nose.plugins.attrib import attr
 from numpy.linalg import norm
 from sklearn.mixture import GaussianMixture
 
@@ -29,7 +28,6 @@ def _get_windows_set():
     return windows_set
 
 
-@attr("requires_bandmat")
 def test_diffvc():
     from nnmnkwii.baseline.gmm import MLPG
 
@@ -62,7 +60,6 @@ def test_diffvc():
         assert norm(tgt_mc - mc_converted1) < norm(src_mc - mc_converted1)
 
 
-@attr("requires_bandmat")
 def test_gmmmap_swap():
     from nnmnkwii.baseline.gmm import MLPG
 
diff --git a/tests/test_datasets.py b/tests/test_datasets.py
index 1f41f13..58556c5 100644
--- a/tests/test_datasets.py
+++ b/tests/test_datasets.py
@@ -1,6 +1,7 @@
 from os.path import dirname, join
 
 import numpy as np
+import pytest
 from nnmnkwii.datasets import (
     FileDataSource,
     FileSourceDataset,
@@ -11,8 +12,6 @@
     example_file_data_sources_for_acoustic_model,
     example_file_data_sources_for_duration_model,
 )
-from nose.plugins.attrib import attr
-from nose.tools import raises
 
 DATA_DIR = join(dirname(__file__), "data")
 
@@ -45,7 +44,8 @@ def __test_outof_range(X):
         print(X[0])
 
     # Should raise IndexError
-    yield raises(IndexError)(__test_outof_range), X
+    with pytest.raises(IndexError):
+        __test_outof_range(X)
 
 
 def test_invalid_dataset():
@@ -71,11 +71,12 @@ def __test_wrong_num_collected_files():
         X = FileSourceDataset(WrongNumberOfCollectedFilesDataSource())
         X[0]
 
-    yield raises(TypeError)(__test_wrong_num_args)
-    yield raises(ValueError)(__test_wrong_num_collected_files)
+    with pytest.raises(TypeError):
+        __test_wrong_num_args()
+    with pytest.raises(ValueError):
+        __test_wrong_num_collected_files()
 
 
-@attr("pickle")
 def test_asarray_tqdm():
     # verbose=1 triggers tqdm progress report
     for padded in [True, False]:
@@ -83,7 +84,6 @@ def test_asarray_tqdm():
         X.asarray(verbose=1)
 
 
-@attr("pickle")
 def test_asarray():
     X, Y = _get_small_datasets(padded=False, duration=True)
     lengths = [len(x) for x in X]
@@ -110,17 +110,16 @@ def __test_very_small_padded_length():
         X.asarray(padded_length=1)
 
     # Should raise `num frames exceeded`
-    yield raises(RuntimeError)(__test_very_small_padded_length)
+    with pytest.raises(RuntimeError):
+        __test_very_small_padded_length()
 
 
-@attr("pickle")
 def test_duration_sources():
     X, Y = _get_small_datasets(padded=False, duration=True)
     for idx, (x, y) in enumerate(zip(X, Y)):
         print(idx, x.shape, y.shape)
 
 
-@attr("pickle")
 def test_slice():
     X, _ = _get_small_datasets(padded=False)
     x = X[:2]
@@ -133,14 +132,12 @@ def test_slice():
     assert len(x.shape) == 3 and x.shape[0] == 2
 
 
-@attr("pickle")
 def test_variable_length_sequence_wise_iteration():
     X, Y = _get_small_datasets(padded=False)
     for idx, (x, y) in enumerate(zip(X, Y)):
         print(idx, x.shape, y.shape)
 
 
-@attr("pickle")
 def test_fixed_length_sequence_wise_iteration():
     X, Y = _get_small_datasets(padded=True)
 
@@ -153,7 +150,6 @@ def test_fixed_length_sequence_wise_iteration():
         assert y.shape[0] == Ty
 
 
-@attr("pickle")
 def test_frame_wise_iteration():
     X, Y = _get_small_datasets(padded=False)
 
@@ -181,7 +177,6 @@ def test_frame_wise_iteration():
         pass
 
 
-@attr("pickle")
 def test_sequence_wise_torch_data_loader():
     import torch
     from torch.utils import data as data_utils
@@ -210,19 +205,20 @@ def __test(X, Y, batch_size):
             print(idx, x.shape, y.shape)
 
     # Test with batch_size = 1
-    yield __test, X, Y, 1
+    __test(X, Y, 1)
     # Since we have variable length frames, batch size larger than 1 causes
     # runtime error.
-    yield raises(RuntimeError)(__test), X, Y, 2
+    with pytest.raises(RuntimeError):
+        __test(X, Y, 2)
 
     # For padded dataset, which can be reprensented by (N, T^max, D), batchsize
     # can be any number.
     X, Y = _get_small_datasets(padded=True)
-    yield __test, X, Y, 1
-    yield __test, X, Y, 2
+    __test(X, Y, 1)
+    __test(X, Y, 2)
 
 
-@attr("pickle")
+# @attr("pickle")
 def test_frame_wise_torch_data_loader():
     import torch
     from torch.utils import data as data_utils
@@ -259,5 +255,5 @@ def __test(X, Y, batch_size):
             assert len(x.shape) == 2
             assert len(y.shape) == 2
 
-    yield __test, X, Y, 128
-    yield __test, X, Y, 256
+    __test(X, Y, 128)
+    __test(X, Y, 256)
diff --git a/tests/test_frontend.py b/tests/test_frontend.py
index b48f48b..11c62fe 100644
--- a/tests/test_frontend.py
+++ b/tests/test_frontend.py
@@ -1,10 +1,10 @@
 from os.path import dirname, join
 
 import numpy as np
+import pytest
 from nnmnkwii.frontend import merlin as fe
 from nnmnkwii.io import hts
 from nnmnkwii.util import example_label_file, example_question_file
-from nose.tools import raises
 
 DATA_DIR = join(dirname(__file__), "data")
 
@@ -14,7 +14,7 @@ def test_invalid_linguistic_features():
     phone_labels = hts.load(example_label_file(phone_level=True))
     state_labels = hts.load(example_label_file(phone_level=False))
 
-    @raises(ValueError)
+    # @raises(ValueError)
     def __test(labels, subphone_features, add_frame_features):
         fe.linguistic_features(
             labels,
@@ -24,19 +24,22 @@ def __test(labels, subphone_features, add_frame_features):
             add_frame_features=add_frame_features,
         )
 
-    yield __test, phone_labels, "full", True
-    yield __test, phone_labels, "full", False
-    yield __test, state_labels, "full", False
+    with pytest.raises(ValueError):
+        __test(phone_labels, "full", True)
+    with pytest.raises(ValueError):
+        __test(phone_labels, "full", False)
+    with pytest.raises(ValueError):
+        __test(state_labels, "full", False)
 
 
 def test_invalid_duration_features():
     phone_labels = hts.load(example_label_file(phone_level=True))
 
-    @raises(ValueError)
     def __test(labels, unit_size, feature_size):
         fe.duration_features(labels, unit_size=unit_size, feature_size=feature_size)
 
-    yield __test, phone_labels, None, "frame"
+    with pytest.raises(ValueError):
+        __test(phone_labels, None, "frame")
 
 
 def test_silence_frame_removal_given_hts_labels():
diff --git a/tests/test_io.py b/tests/test_io.py
index c2b6146..03426ad 100644
--- a/tests/test_io.py
+++ b/tests/test_io.py
@@ -2,10 +2,10 @@
 import re
 from os.path import dirname, join
 
+import pytest
 from nnmnkwii.frontend import merlin as fe
 from nnmnkwii.io import hts
 from nnmnkwii.util import example_question_file
-from nose.tools import raises
 
 try:
     import pyopenjtalk  # noqa
@@ -183,7 +183,6 @@ def test_hts_append():
         labels.append(label)
     assert str(test_labels) == str(labels)
 
-    @raises(ValueError)
     def test_invalid_start_time():
         labels = hts.HTSLabelFile()
         labels.append((100000, 0, "NG"))
@@ -193,7 +192,6 @@ def test_succeeding_times():
         labels.append((0, 1000000, "OK"))
         labels.append((1000000, 2000000, "OK"))
 
-    @raises(ValueError)
     def test_non_succeeding_times():
         labels = hts.HTSLabelFile()
         labels.append((0, 1000000, "OK"))
@@ -204,9 +202,11 @@ def test_non_succeeding_times_wo_strict():
         labels.append((0, 1000000, "OK"), strict=False)
         labels.append((1500000, 2000000, "OK"), strict=False)
 
-    test_invalid_start_time()
+    with pytest.raises(ValueError):
+        test_invalid_start_time()
     test_succeeding_times()
-    test_non_succeeding_times()
+    with pytest.raises(ValueError):
+        test_non_succeeding_times()
     test_non_succeeding_times_wo_strict()
 
 
@@ -227,20 +227,20 @@ def test_create_from_contexts():
     labels2 = hts.HTSLabelFile.create_from_contexts(contexts)
     assert str(labels), str(labels2)
 
-    @raises(ValueError)
     def test_empty_context():
         hts.HTSLabelFile.create_from_contexts("")
 
-    @raises(ValueError)
     def test_empty_context2():
         contexts = pyopenjtalk.extract_fullcontext("")
         hts.HTSLabelFile.create_from_contexts(contexts)
 
-    test_empty_context()
+    with pytest.raises(ValueError):
+        test_empty_context()
     try:
         import pyopenjtalk  # noqa
 
-        test_empty_context2()
+        with pytest.raises(ValueError):
+            test_empty_context2()
     except ImportError:
         pass
 
diff --git a/tests/test_metrics.py b/tests/test_metrics.py
index e59d405..8ebf1df 100644
--- a/tests/test_metrics.py
+++ b/tests/test_metrics.py
@@ -28,8 +28,8 @@ def __test(f):
             np.testing.assert_almost_equal(f(x, y, lengths), f(x, y), decimal=5)
             assert f(x, y) > 0
 
-    yield __test, metrics.melcd
-    yield __test, metrics.mean_squared_error
+    __test(metrics.melcd)
+    __test(metrics.mean_squared_error)
 
 
 def test_f0_mse():
diff --git a/tests/test_paramgen.py b/tests/test_paramgen.py
index ebe52b7..759000a 100644
--- a/tests/test_paramgen.py
+++ b/tests/test_paramgen.py
@@ -1,5 +1,4 @@
 import numpy as np
-from nose.plugins.attrib import attr
 
 
 def _get_windows_set():
@@ -29,7 +28,6 @@ def _get_windows_set():
     return windows_set
 
 
-@attr("requires_bandmat")
 def test_mlpg():
     from nnmnkwii import paramgen as G
 
@@ -61,7 +59,6 @@ def test_mlpg():
             assert np.allclose(generated1, generated2)
 
 
-@attr("requires_bandmat")
 def test_mlpg_window_full():
     from nnmnkwii import paramgen as G
 
@@ -82,7 +79,6 @@ def full_window_mat_native(win_mats, T):
         assert np.allclose(full_window_mat_native(win_mats, T), fullwin)
 
 
-@attr("requires_bandmat")
 def test_unit_variance_mlpg():
     from nnmnkwii import paramgen as G
 
@@ -99,7 +95,6 @@ def test_unit_variance_mlpg():
         assert np.allclose(y_hat, y)
 
 
-@attr("requires_bandmat")
 def test_reshape_means():
     from nnmnkwii import paramgen as G
 
diff --git a/tests/test_postfilters.py b/tests/test_postfilters.py
index a037100..bb978fe 100644
--- a/tests/test_postfilters.py
+++ b/tests/test_postfilters.py
@@ -1,5 +1,3 @@
-from __future__ import absolute_import, division, print_function
-
 from os.path import dirname, join
 
 import numpy as np
diff --git a/tests/test_preprocessing.py b/tests/test_preprocessing.py
index 4da89d9..8a25541 100644
--- a/tests/test_preprocessing.py
+++ b/tests/test_preprocessing.py
@@ -1,8 +1,7 @@
-from __future__ import absolute_import, division, print_function
-
 import librosa
 import numpy as np
 import pysptk
+import pytest
 import pyworld
 from nnmnkwii import preprocessing as P
 from nnmnkwii.datasets import FileSourceDataset, PaddedFileSourceDataset
@@ -21,8 +20,6 @@
     example_file_data_sources_for_acoustic_model,
     example_file_data_sources_for_duration_model,
 )
-from nose.plugins.attrib import attr
-from nose.tools import raises
 from scipy.io import wavfile
 
 
@@ -215,16 +212,16 @@ def test_minmax():
     assert np.isfinite(x_scaled).all()
 
     # Need to specify (min, max) or (scale_, min_)
-    @raises(ValueError)
     def __test_raise1(x, X_min, X_max):
         P.minmax_scale(x)
 
-    @raises(ValueError)
     def __test_raise2(x, X_min, X_max):
         P.inv_minmax_scale(x)
 
-    __test_raise1(x, X_min, X_max)
-    __test_raise2(x, X_min, X_max)
+    with pytest.raises(ValueError):
+        __test_raise1(x, X_min, X_max)
+    with pytest.raises(ValueError):
+        __test_raise2(x, X_min, X_max)
 
     # Explicit scale_ and min_
     min_, scale_ = P.minmax_scale_params(X_min, X_max, feature_range=(0, 0.99))
@@ -433,7 +430,6 @@ def _get_mcep(x, fs, frame_period=5, order=24):
     return mc
 
 
-@attr("requires_bandmat")
 def test_dtw_frame_length_adjustment():
     from nnmnkwii.preprocessing.alignment import DTWAligner, IterativeDTWAligner
 
@@ -453,7 +449,6 @@ def test_dtw_frame_length_adjustment():
         assert X_aligned.shape == Y_aligned.shape
 
 
-@attr("requires_bandmat")
 def test_dtw_aligner():
     from nnmnkwii.preprocessing.alignment import DTWAligner, IterativeDTWAligner
 
@@ -527,14 +522,14 @@ def test_modspec_smoothing():
                 )
 
     # Cutoff frequency larger than modfs//2
-    @raises(ValueError)
     def __test_invalid_param(y, modfs):
         P.modspec_smoothing(y, modfs, n=2048, cutoff=modfs // 2 + 1)
 
     # FFT size should larger than time length
-    @raises(RuntimeError)
     def __test_invalid_time_length(y, modfs):
         P.modspec_smoothing(y, modfs, n=32, cutoff=modfs // 2)
 
-    __test_invalid_time_length(y, modfs)
-    __test_invalid_param(y, modfs)
+    with pytest.raises(ValueError):
+        __test_invalid_param(y, modfs)
+    with pytest.raises(RuntimeError):
+        __test_invalid_time_length(y, modfs)
diff --git a/tests/test_real_datasets.py b/tests/test_real_datasets.py
index 3793b9c..aa94943 100644
--- a/tests/test_real_datasets.py
+++ b/tests/test_real_datasets.py
@@ -1,8 +1,10 @@
 from os.path import exists, expanduser, join
+from pathlib import Path
 from warnings import warn
 
 import numpy as np
 import pysptk
+import pytest
 import pyworld
 
 # Data source implementations
@@ -17,8 +19,6 @@
     voice_statistics,
 )
 from nnmnkwii.preprocessing import trim_zeros_frames
-from nose.plugins.attrib import attr
-from nose.tools import raises
 from scipy.io import wavfile
 
 # Tests marked with "require_local_data" needs data to be downloaded.
@@ -27,43 +27,47 @@
 def test_cmu_arctic_dummy():
     data_source = cmu_arctic.WavFileDataSource("dummy", speakers=["clb"])
 
-    @raises(ValueError)
     def __test_invalid_speaker():
         cmu_arctic.WavFileDataSource("dummy", speakers=["test"])
 
-    @raises(RuntimeError)
     def __test_nodir(data_source):
         data_source.collect_files()
 
-    __test_invalid_speaker()
-    __test_nodir(data_source)
+    with pytest.raises(ValueError):
+        __test_invalid_speaker()
+    with pytest.raises(RuntimeError):
+        __test_nodir(data_source)
 
 
 def test_voice_statistics_dummy():
     data_source = voice_statistics.WavFileDataSource("dummy", speakers=["fujitou"])
 
-    @raises(ValueError)
+    # @raises(ValueError)
     def __test_invalid_speaker():
         voice_statistics.WavFileDataSource("dummy", speakers=["test"])
 
-    @raises(ValueError)
+    # @raises(ValueError)
     def __test_invalid_emotion():
         voice_statistics.WavFileDataSource(
             "dummy", speakers=["fujitou"], emotions="nnmnkwii"
         )
 
-    @raises(RuntimeError)
+    # @raises(RuntimeError)
     def __test_nodir(data_source):
         data_source.collect_files()
 
-    @raises(RuntimeError)
+    # @raises(RuntimeError)
     def __test_no_trans():
         voice_statistics.TranscriptionDataSource("dummy")
 
-    __test_invalid_speaker()
-    __test_invalid_emotion()
-    __test_nodir(data_source)
-    __test_no_trans()
+    with pytest.raises(ValueError):
+        __test_invalid_speaker()
+    with pytest.raises(ValueError):
+        __test_invalid_emotion()
+    with pytest.raises(RuntimeError):
+        __test_nodir(data_source)
+    with pytest.raises(RuntimeError):
+        __test_no_trans()
 
 
 def test_ljspeech_dummy():
@@ -75,26 +79,26 @@ def test_ljspeech_dummy():
 
     for data_source in data_sources:
 
-        @raises(RuntimeError)
         def f(source):
             source("dummy")
 
-        f(data_source)
+        with pytest.raises(RuntimeError):
+            f(data_source)
 
 
 def test_vcc2016_dummy():
     data_source = vcc2016.WavFileDataSource("dummy", speakers=["SF1"])
 
-    @raises(ValueError)
     def __test_invalid_speaker():
         vcc2016.WavFileDataSource("dummy", speakers=["test"])
 
-    @raises(RuntimeError)
     def __test_nodir(data_source):
         data_source.collect_files()
 
-    __test_invalid_speaker()
-    __test_nodir(data_source)
+    with pytest.raises(ValueError):
+        __test_invalid_speaker()
+    with pytest.raises(RuntimeError):
+        __test_nodir(data_source)
 
 
 def test_jsut_dummy():
@@ -102,11 +106,11 @@ def test_jsut_dummy():
 
     for data_source in data_sources:
 
-        @raises(RuntimeError)
         def f(source):
             source("dummy")
 
-        f(data_source)
+        with pytest.raises(RuntimeError):
+            f(data_source)
 
 
 def test_vctk_dummy():
@@ -115,11 +119,11 @@ def test_vctk_dummy():
 
     for data_source in data_sources:
 
-        @raises(RuntimeError)
         def f(source):
             source("dummy")
 
-        f(data_source)
+        with pytest.raises(RuntimeError):
+            f(data_source)
 
 
 def test_jvs_dummy():
@@ -128,15 +132,16 @@ def test_jvs_dummy():
 
     for data_source in data_sources:
 
-        @raises(RuntimeError)
         def f(source):
             source("dummy", categories=["parallel"])
 
-        f(data_source)
+        with pytest.raises(RuntimeError):
+            f(data_source)
 
 
-@attr("require_local_data")
-@attr("require_cmu_arctic")
+@pytest.mark.skipif(
+    not (Path.home() / "data" / "cmu_arctic").exists(), reason="Data doesn't exist"
+)
 def test_cmu_arctic():
     DATA_DIR = join(expanduser("~"), "data", "cmu_arctic")
     if not exists(DATA_DIR):
@@ -196,8 +201,10 @@ def collect_features(self, path):
     assert len(X) == 1132 * 2
 
 
-@attr("require_local_data")
-@attr("require_voice_statistics")
+@pytest.mark.skipif(
+    not (Path.home() / "data" / "voice-statistics").exists(),
+    reason="Data doesn't exist",
+)
 def test_voice_statistics():
     DATA_DIR = join(expanduser("~"), "data", "voice-statistics")
     if not exists(DATA_DIR):
@@ -293,10 +300,11 @@ def collect_features(self, path):
     assert texts[0] == "また東寺のように五大明王と呼ばれる主要な明王の中央に配されることも多い"
 
 
-@attr("require_local_data")
-@attr("require_ljspeech")
+@pytest.mark.skipif(
+    not (Path.home() / "data" / "LJSpeech-1.1").exists(), reason="Data doesn't exist"
+)
 def test_ljspeech():
-    DATA_DIR = join(expanduser("~"), "data", "LJSpeech-1.0")
+    DATA_DIR = join(expanduser("~"), "data", "LJSpeech-1.1")
     if not exists(DATA_DIR):
         warn("Data doesn't exist at {}".format(DATA_DIR))
         return
@@ -344,8 +352,9 @@ def collect_features(self, path):
     print(X[0].shape)
 
 
-@attr("require_local_data")
-@attr("require_vcc2016")
+@pytest.mark.skipif(
+    not (Path.home() / "data" / "vcc2016").exists(), reason="Data doesn't exist"
+)
 def test_vcc2016():
     DATA_DIR = join(expanduser("~"), "data", "vcc2016")
     if not exists(DATA_DIR):
@@ -405,8 +414,9 @@ def collect_features(self, path):
     assert len(X) == 162 * 2
 
 
-@attr("require_local_data")
-@attr("require_jsut")
+@pytest.mark.skipif(
+    not (Path.home() / "data" / "jsut_ver1.1").exists(), reason="Data doesn't exist"
+)
 def test_jsut():
     DATA_DIR = join(expanduser("~"), "data", "jsut_ver1.1")
     if not exists(DATA_DIR):
@@ -462,8 +472,9 @@ def collect_features(self, path):
     print(X[0].shape)
 
 
-@attr("require_local_data")
-@attr("require_vctk")
+@pytest.mark.skipif(
+    not (Path.home() / "data" / "VCTK-Corpus").exists(), reason="Data doesn't exist"
+)
 def test_vctk():
     DATA_DIR = join(expanduser("~"), "data", "VCTK-Corpus")
     if not exists(DATA_DIR):
@@ -551,8 +562,9 @@ def collect_features(self, path):
     print(X[0].shape)
 
 
-@attr("require_local_data")
-@attr("require_jvs")
+@pytest.mark.skipif(
+    not (Path.home() / "data" / "jvs_ver1").exists(), reason="Data doesn't exist"
+)
 def test_jvs():
     DATA_DIR = join(expanduser("~"), "Downloads", "jvs_ver1")
     if not exists(DATA_DIR):
diff --git a/tests/test_util.py b/tests/test_util.py
index 57612f9..2a6c6e1 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -1,10 +1,7 @@
-from __future__ import absolute_import, division, print_function
-
 import numpy as np
 import scipy.linalg
 from nnmnkwii.util import apply_each2d_padded, apply_each2d_trim
 from nnmnkwii.util.linalg import cholesky_inv, cholesky_inv_banded
-from nose.plugins.attrib import attr
 
 
 def _get_windows_set():
@@ -62,7 +59,6 @@ def _get_banded_test_mat(win_mats, T):
     return P
 
 
-@attr("requires_bandmat")
 def test_linalg_choleskey_inv():
     from nnmnkwii.paramgen import build_win_mats