diff --git a/.github/workflows/array-api-tests.yml b/.github/workflows/array-api-tests.yml index 6936740..41d6367 100644 --- a/.github/workflows/array-api-tests.yml +++ b/.github/workflows/array-api-tests.yml @@ -11,15 +11,17 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] - numpy-version: ['1.26', '2.3', 'dev'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] + numpy-version: ['1.26', '2.3.5', 'dev'] exclude: - python-version: '3.10' - numpy-version: '2.3' + numpy-version: '2.3.5' - python-version: '3.10' numpy-version: 'dev' - python-version: '3.13' numpy-version: '1.26' + - python-version: '3.14' + numpy-version: '1.26' fail-fast: false steps: - name: Checkout array-api-strict diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c506200..59f4252 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,15 +5,17 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] - numpy-version: ['1.26', '2.3', 'dev'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] + numpy-version: ['1.26', '2.3.5', 'dev'] exclude: - python-version: '3.10' - numpy-version: '2.3' + numpy-version: '2.3.5' - python-version: '3.10' numpy-version: 'dev' - python-version: '3.13' numpy-version: '1.26' + - python-version: '3.14' + numpy-version: '1.26' fail-fast: false steps: - uses: actions/checkout@v6 @@ -26,9 +28,10 @@ jobs: if [[ "${{ matrix.numpy-version }}" == "dev" ]]; then python -m pip install --pre --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy; else - python -m pip install 'numpy>=1.26,<2.0'; + python -m pip install 'numpy=='${{ matrix.numpy-version }} fi - python -m pip install -r requirements-dev.txt + python -m pip install pytest hypothesis + python -c'import numpy as np; print(f"{np.__version__ = }")' - name: Run Tests run: | pytest diff --git a/array_api_strict/tests/test_array_object.py b/array_api_strict/tests/test_array_object.py index 6e171a0..c98981b 100644 --- a/array_api_strict/tests/test_array_object.py +++ b/array_api_strict/tests/test_array_object.py @@ -1,8 +1,9 @@ import sys +import warnings import operator from builtins import all as all_ -from numpy.testing import assert_raises, suppress_warnings +from numpy.testing import assert_raises import numpy as np import pytest @@ -269,10 +270,12 @@ def _check_op_array_scalar(dtypes, a, s, func, func_name, BIG_INT=BIG_INT): else: # Only test for no error - with suppress_warnings() as sup: + with warnings.catch_warnings(): # ignore warnings from pow(BIG_INT) - sup.filter(RuntimeWarning, - "invalid value encountered in power") + warnings.filterwarnings( + "ignore", category=RuntimeWarning, + message="invalid value encountered in power" + ) func(s) return True diff --git a/array_api_strict/tests/test_elementwise_functions.py b/array_api_strict/tests/test_elementwise_functions.py index 0f740d3..e8a6d32 100644 --- a/array_api_strict/tests/test_elementwise_functions.py +++ b/array_api_strict/tests/test_elementwise_functions.py @@ -1,8 +1,8 @@ +import warnings from inspect import signature, getmodule import numpy as np import pytest -from numpy.testing import suppress_warnings from .. import asarray, _elementwise_functions @@ -300,10 +300,13 @@ def _array_vals(): if allowed: conv_scalar = a._promote_scalar(s) - with suppress_warnings() as sup: + with warnings.catch_warnings(): # ignore warnings from pow(BIG_INT) - sup.filter(RuntimeWarning, - "invalid value encountered in power") + warnings.filterwarnings( + "ignore", category=RuntimeWarning, + message="invalid value encountered in power" + ) + assert func(s, a) == func(conv_scalar, a) assert func(a, s) == func(a, conv_scalar)