From e7e4de61ed172ff29febacf38e1e4c6aaee4ad0a Mon Sep 17 00:00:00 2001 From: Ryuichi Yamamoto Date: Sat, 29 Jun 2024 14:09:56 +0900 Subject: [PATCH] workaround pyworld installation issue pyworld's bindary distribution does not support numpy 2.0.0. so runtime errors will happen on windows if numpy 2.0.0 is used workaaround this issue by skipping the tests using pyworld --- tests/test_preprocessing.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_preprocessing.py b/tests/test_preprocessing.py index 11aee6e..27363ec 100644 --- a/tests/test_preprocessing.py +++ b/tests/test_preprocessing.py @@ -1,7 +1,6 @@ import numpy as np import pysptk import pytest -import pyworld from nnmnkwii import preprocessing as P from nnmnkwii.datasets import FileSourceDataset, PaddedFileSourceDataset from nnmnkwii.preprocessing import ( @@ -22,6 +21,14 @@ from packaging.version import Version from scipy.io import wavfile +try: + import pyworld + + pyworld_available = True +except ValueError: + # ValueError: numpy.dtype size changed, may indicate binary incompatibility. + pyworld_available = False + def _get_windows_set_bandmat(): windows_set = [ @@ -271,6 +278,7 @@ def test_interp1d(): assert np.all(if0 != 0) +@pytest.mark.skipif(not pyworld_available, reason="pyworld is not available") def test_trim_remove_zeros_frames(): fs, x = wavfile.read(example_audio_file()) frame_period = 5 @@ -452,6 +460,7 @@ def test_dtw_frame_length_adjustment(): @pytest.mark.skipif( Version(np.__version__) >= Version("2.0.0"), reason="numpy >= 2.0.0" ) +@pytest.mark.skipif(not pyworld_available, reason="pyworld is not available") def test_dtw_aligner(): from nnmnkwii.preprocessing.alignment import DTWAligner, IterativeDTWAligner