From d27852745e73662f3d407912c635eea79d8754fd Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Sun, 30 Nov 2025 17:58:28 +0100 Subject: [PATCH 1/4] CI: test on python 3.14 --- .github/workflows/array-api-tests.yml | 4 +++- .github/workflows/tests.yml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/array-api-tests.yml b/.github/workflows/array-api-tests.yml index 6936740..ffd83d9 100644 --- a/.github/workflows/array-api-tests.yml +++ b/.github/workflows/array-api-tests.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] numpy-version: ['1.26', '2.3', 'dev'] exclude: - python-version: '3.10' @@ -20,6 +20,8 @@ jobs: 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..c101e9c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] numpy-version: ['1.26', '2.3', 'dev'] exclude: - python-version: '3.10' @@ -14,6 +14,8 @@ jobs: 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 From 2b85cef2faa947088410699bb593afaa80b578a0 Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Sun, 30 Nov 2025 18:07:00 +0100 Subject: [PATCH 2/4] CI: actually install numpy 2.x --- .github/workflows/tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c101e9c..4071baf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,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 From 2dab4c179d1cee77241e71fea5628b46432d5407 Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Sun, 30 Nov 2025 18:10:21 +0100 Subject: [PATCH 3/4] CI: use numpy 2.3.5 for python 3.14 support --- .github/workflows/array-api-tests.yml | 4 ++-- .github/workflows/tests.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/array-api-tests.yml b/.github/workflows/array-api-tests.yml index ffd83d9..41d6367 100644 --- a/.github/workflows/array-api-tests.yml +++ b/.github/workflows/array-api-tests.yml @@ -12,10 +12,10 @@ jobs: strategy: matrix: python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] - numpy-version: ['1.26', '2.3', 'dev'] + 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' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4071baf..59f4252 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,10 +6,10 @@ jobs: strategy: matrix: python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] - numpy-version: ['1.26', '2.3', 'dev'] + 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' From 3ad5509ff8e7f465ab01f9fc69c4c88d279fcfa0 Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Sun, 30 Nov 2025 18:21:39 +0100 Subject: [PATCH 4/4] TST: replace (now-deprecared) suppress_warnings with stdlib warnings.filterwarnings --- array_api_strict/tests/test_array_object.py | 11 +++++++---- array_api_strict/tests/test_elementwise_functions.py | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) 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)