From fd6a963fbb6eeabbdbc868b859c18407f43310b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9onie=20Borne?= Date: Thu, 6 Jul 2023 14:58:46 +0200 Subject: [PATCH] [ci] Fix tests in continuous integration (#672) * limit pytorch-lightning to 1.x versions * torch<2.0.0 + add limit in setup.py * replace py.test by pytest * move flake8 ignore comments * scipy.signal.get_window(window=hanning) not supported in scipy v1.10.1, replaced by hann * scipy>=1.10.1 * pytorch-lightning<=1.7.7 because Callback.on_epoch_start hook was removed in v1.8 * use window=hann instead of hanning in the unit tests * pytorch-lightning<=1.7.7 in setup.py --- .flake8 | 15 ++++++++++----- .github/workflows/test_asteroid_package.yml | 4 ++-- asteroid/dsp/overlap_add.py | 2 +- requirements/install.txt | 3 ++- requirements/torchhub.txt | 2 +- setup.py | 5 +++-- tests/dsp/overlap_add_test.py | 2 +- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.flake8 b/.flake8 index 2590a183e..2bb811b6b 100644 --- a/.flake8 +++ b/.flake8 @@ -6,8 +6,13 @@ verbose = 2 # https://pep8.readthedocs.io/en/latest/intro.html#error-codes format = pylint ignore = - E731 # E731 - Do not assign a lambda expression, use a def - W605 # W605 - invalid escape sequence '\_'. Needed for docs - W504 # W504 - line break after binary operator - W503 # W503 - line break before binary operator, need for black - E203 # E203 - whitespace before ':'. Opposite convention enforced by black + # E731 - Do not assign a lambda expression, use a def + E731 + # W605 - invalid escape sequence '\_'. Needed for docs + W605 + # W504 - line break after binary operator + W504 + # W503 - line break before binary operator, need for black + W503 + # E203 - whitespace before ':'. Opposite convention enforced by black + E203 diff --git a/.github/workflows/test_asteroid_package.yml b/.github/workflows/test_asteroid_package.yml index 7cbe7c7a9..c860083a6 100644 --- a/.github/workflows/test_asteroid_package.yml +++ b/.github/workflows/test_asteroid_package.yml @@ -47,14 +47,14 @@ jobs: - name: Source code tests run: | - coverage run -a -m py.test tests --ignore tests/models/publish_test.py + coverage run -a -m pytest tests --ignore tests/models/publish_test.py chmod +x ./tests/cli_test.sh ./tests/cli_test.sh # This tends to fail despite the code works, when Zenodo is slow. - name: Model-sharing tests run: | - coverage run -a -m py.test tests/models/publish_test.py + coverage run -a -m pytest tests/models/publish_test.py env: ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} diff --git a/asteroid/dsp/overlap_add.py b/asteroid/dsp/overlap_add.py index 7ba624f2f..256b43bc5 100644 --- a/asteroid/dsp/overlap_add.py +++ b/asteroid/dsp/overlap_add.py @@ -55,7 +55,7 @@ def __init__( n_src, window_size, hop_size=None, - window="hanning", + window="hann", reorder_chunks=True, enable_grad=False, ): diff --git a/requirements/install.txt b/requirements/install.txt index 568d9c3f3..ab521c439 100644 --- a/requirements/install.txt +++ b/requirements/install.txt @@ -2,7 +2,8 @@ -r ./torchhub.txt PyYAML>=5.0 pandas>=0.23.4 -pytorch-lightning>=1.5.0,<2.0.0 +pytorch-lightning>=1.5.0,<=1.7.7 +torchmetrics<=0.11.4 torchaudio>=0.8.0 pb_bss_eval>=0.0.2 torch_stoi>=0.0.1 diff --git a/requirements/torchhub.txt b/requirements/torchhub.txt index 00e0ddbfc..c6cd82628 100644 --- a/requirements/torchhub.txt +++ b/requirements/torchhub.txt @@ -1,7 +1,7 @@ # Minimal set of requirements required to be able to run Asteroid models from Torch Hub. # Note that Asteroid itself is not required to be installed. numpy>=1.16.4 -scipy>=1.1.0 +scipy>=1.10.1 torch>=1.8.0,<2.0.0 asteroid-filterbanks>=0.4.0 requests diff --git a/setup.py b/setup.py index 2c77772b1..0b287c21c 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ def find_version(*file_paths): install_requires=[ # From requirements/torchhub.txt "numpy>=1.16.4", - "scipy>=1.1.0", + "scipy>=1.10.1", "torch>=1.8.0,<2.0.0", "asteroid-filterbanks>=0.4.0", "SoundFile>=0.10.2", @@ -46,7 +46,8 @@ def find_version(*file_paths): # From requirements/install.txt "PyYAML>=5.0", "pandas>=0.23.4", - "pytorch-lightning>=1.5.0,<2.0.0", + "pytorch-lightning>=1.5.0,<=1.7.7", + "torchmetrics<=0.11.4", "torchaudio>=0.5.0", "pb_bss_eval>=0.0.2", "torch_stoi>=0.1.2", diff --git a/tests/dsp/overlap_add_test.py b/tests/dsp/overlap_add_test.py index fc43f38ff..18572f78a 100644 --- a/tests/dsp/overlap_add_test.py +++ b/tests/dsp/overlap_add_test.py @@ -8,7 +8,7 @@ @pytest.mark.parametrize("length", [1390, 8372]) @pytest.mark.parametrize("batch_size", [1, 2]) @pytest.mark.parametrize("n_src", [1, 2]) -@pytest.mark.parametrize("window", ["hanning", None]) +@pytest.mark.parametrize("window", ["hann", None]) @pytest.mark.parametrize("window_size", [128]) @pytest.mark.parametrize("hop_size", [64]) def test_overlap_add(length, batch_size, n_src, window, window_size, hop_size):