From 74e0cc1b9417a27832d5abe3c68dd4fad8edb16f Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Fri, 15 Sep 2023 05:58:58 -0700 Subject: [PATCH] Test on Python 3.12 (#683) --- .github/workflows/tests.yml | 34 ++++++++++++++++++++++++---------- pyproject.toml | 2 +- pywt/tests/test_wavelet.py | 4 ++-- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f4718678..0bce461c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: # Ensure that a wheel builder finishes even if another fails fail-fast: false matrix: - python-version: [3.9, '3.10', '3.11'] + python-version: [3.9, '3.10', '3.11', '3.12'] MINIMUM_REQUIREMENTS: [0] USE_SCIPY: [0] USE_SDIST: [0] @@ -56,6 +56,13 @@ jobs: python-version: '3.11' PIP_FLAGS: "--pre" OPTIONS_NAME: "pre-releases" + - platform_id: manylinux_x86_64 + python-version: '3.12' + PIP_FLAGS: "--pre" + OPTIONS_NAME: "pre-releases" + exclude: + - python-version: '3.12' + PIP_FLAGS: [""] steps: - name: Checkout PyWavelets @@ -65,6 +72,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version}} + allow-prereleases: true - name: Build package env: @@ -90,11 +98,11 @@ jobs: pip install ${NUMPY_MIN} if [ "${USE_SCIPY}" == "1" ]; then pip install ${SCIPY_MIN}; fi else - pip install cython - pip install numpy - if [ "${USE_SCIPY}" == "1" ]; then pip install scipy; fi + pip install ${PIP_FLAGS} cython + pip install ${PIP_FLAGS} numpy + if [ "${USE_SCIPY}" == "1" ]; then pip install ${PIP_FLAGS} scipy; fi fi - pip install matplotlib pytest + pip install ${PIP_FLAGS} matplotlib pytest set -o pipefail if [ "${USE_WHEEL}" == "1" ]; then @@ -113,7 +121,6 @@ jobs: - name: Run tests env: - PIP_FLAGS: ${{ matrix.PIP_FLAGS }} USE_WHEEL: ${{ matrix.USE_WHEEL }} USE_SDIST: ${{ matrix.USE_SDIST }} REFGUIDE_CHECK: ${{ matrix.REFGUIDE_CHECK }} @@ -150,7 +157,7 @@ jobs: # Ensure that a wheel builder finishes even if another fails fail-fast: false matrix: - python-version: [3.9, '3.11'] + python-version: [3.9, '3.11', '3.12'] MINIMUM_REQUIREMENTS: [0] USE_SCIPY: [0] USE_SDIST: [0] @@ -165,6 +172,12 @@ jobs: - python-version: '3.11' PIP_FLAGS: "--pre" OPTIONS_NAME: "pre-releases" + - python-version: '3.12' + PIP_FLAGS: "--pre" + OPTIONS_NAME: "pre-releases" + exclude: + - python-version: '3.12' + PIP_FLAGS: [""] steps: - name: Checkout PyWavelets @@ -174,6 +187,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version}} + allow-prereleases: true - name: Build package env: @@ -198,10 +212,10 @@ jobs: pip install ${CYTHON_MIN} ${NUMPY_MIN} if [ "${USE_SCIPY}" == "1" ]; then pip install ${SCIPY_MIN}; fi else - pip install cython numpy - if [ "${USE_SCIPY}" == "1" ]; then pip install scipy; fi + pip install ${PIP_FLAGS} cython numpy + if [ "${USE_SCIPY}" == "1" ]; then pip install ${PIP_FLAGS} scipy; fi fi - pip install matplotlib pytest + pip install ${PIP_FLAGS} matplotlib pytest set -o pipefail if [ "${USE_WHEEL}" == "1" ]; then diff --git a/pyproject.toml b/pyproject.toml index 75b17496..f9b44314 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ requires = [ # For Python versions which aren't yet officially supported, we specify an # unpinned NumPy which allows source distributions to be used and allows # wheels to be used as soon as they become available. - "numpy>=1.26.0b1; python_version>='3.12rc2'", + "numpy>=1.26.0b1; python_version>='3.12'", "numpy; python_version>='3.9' and platform_python_implementation=='PyPy'", ] diff --git a/pywt/tests/test_wavelet.py b/pywt/tests/test_wavelet.py index e3f1addb..00346100 100644 --- a/pywt/tests/test_wavelet.py +++ b/pywt/tests/test_wavelet.py @@ -171,8 +171,8 @@ def test_custom_wavelet(): filter_bank=filter_bank) # check expected default wavelet properties - assert_(~haar_custom2.orthogonal) - assert_(~haar_custom2.biorthogonal) + assert_(not haar_custom2.orthogonal) + assert_(not haar_custom2.biorthogonal) assert_(haar_custom2.symmetry == 'unknown') assert_(haar_custom2.family_name == '') assert_(haar_custom2.short_family_name == '')