Skip to content

Commit 5d883a8

Browse files
authored
Merge pull request data-apis#244 from honno/ci-updates
CI updates
2 parents 5811393 + 526c2d4 commit 5d883a8

35 files changed

+122
-145
lines changed

.github/workflows/numpy.yml renamed to .github/workflows/test.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: NumPy Array API
1+
name: Test Array API Strict
22

33
on: [push, pull_request]
44

@@ -22,10 +22,12 @@ jobs:
2222
- name: Install dependencies
2323
run: |
2424
python -m pip install --upgrade pip
25-
python -m pip install numpy==1.26.2
25+
python -m pip install array-api-strict
2626
python -m pip install -r requirements.txt
2727
- name: Run the test suite
2828
env:
29-
ARRAY_API_TESTS_MODULE: numpy.array_api
29+
ARRAY_API_TESTS_MODULE: array_api_strict
3030
run: |
31-
pytest -v -rxXfE --ci --skips-file numpy-skips.txt
31+
pytest -v -rxXfE --skips-file array-api-strict-skips.txt array_api_tests/
32+
# We also have internal tests that isn't really necessary for adopters
33+
pytest -v -rxXfE meta_tests/

README.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ issues](https://github.com/data-apis/array-api-tests/issues/) to us.
138138

139139
## Running on CI
140140

141-
See our existing [GitHub Actions workflow for
142-
Numpy](https://github.com/data-apis/array-api-tests/blob/master/.github/workflows/numpy.yml)
143-
for an example of using the test suite on CI.
141+
See our existing [GitHub Actions workflow for `array-api-strict`](https://github.com/data-apis/array-api-tests/blob/master/.github/workflows/test.yml)
142+
for an example of using the test suite on CI. Note [`array-api-strict`](https://github.com/data-apis/array-api-strict)
143+
is an implementation of the array API that uses NumPy under the hood.
144144

145145
### Releases
146146

@@ -161,12 +161,6 @@ You can specify the API version to use when testing via the
161161
array module's `__array_api_version__` value, and if that attribute doesn't
162162
exist then we fallback to `"2021.12"`.
163163

164-
#### CI flag
165-
166-
Use the `--ci` flag to run only the primary and special cases tests. You can
167-
ignore the other test cases as they are redundant for the purposes of checking
168-
compliance.
169-
170164
#### Data-dependent shapes
171165

172166
Use the `--disable-data-dependent-shapes` flag to skip testing functions which have

array-api-strict-skips.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Known special case issue in NumPy. Not worth working around here
2+
# https://github.com/numpy/numpy/issues/21213
3+
array_api_tests/test_special_cases.py::test_iop[__ipow__(x1_i is -infinity and x2_i > 0 and not (x2_i.is_integer() and x2_i % 2 == 1)) -> +infinity]
4+
array_api_tests/test_special_cases.py::test_iop[__ipow__(x1_i is -0 and x2_i > 0 and not (x2_i.is_integer() and x2_i % 2 == 1)) -> +0]
5+
6+
# The test suite is incorrectly checking sums that have loss of significance
7+
# (https://github.com/data-apis/array-api-tests/issues/168)
8+
array_api_tests/test_statistical_functions.py::test_sum

array_api_tests/pytest_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def assert_array_elements(
485485
>>> assert xp.all(out == x)
486486
487487
"""
488-
# __tracebackhide__ = True
488+
__tracebackhide__ = True
489489
dh.result_type(out.dtype, expected.dtype) # sanity check
490490
assert_shape(func_name, out_shape=out.shape, expected=expected.shape, kw=kw) # sanity check
491491
f_func = f"[{func_name}({fmt_kw(kw)})]"

array_api_tests/test_array_object.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
from . import xp as _xp
1717
from .typing import DataType, Index, Param, Scalar, ScalarType, Shape
1818

19-
pytestmark = pytest.mark.ci
20-
2119

2220
def scalar_objects(
2321
dtype: DataType, shape: Shape
@@ -107,6 +105,7 @@ def test_getitem(shape, dtype, data):
107105
ph.assert_array_elements("__getitem__", out=out, expected=expected)
108106

109107

108+
@pytest.mark.unvectorized
110109
@given(
111110
shape=hh.shapes(),
112111
dtypes=hh.oneway_promotable_dtypes(dh.all_dtypes),
@@ -154,6 +153,7 @@ def test_setitem(shape, dtypes, data):
154153
)
155154

156155

156+
@pytest.mark.unvectorized
157157
@pytest.mark.data_dependent_shapes
158158
@given(hh.shapes(), st.data())
159159
def test_getitem_masking(shape, data):
@@ -199,6 +199,7 @@ def test_getitem_masking(shape, data):
199199
)
200200

201201

202+
@pytest.mark.unvectorized
202203
@given(hh.shapes(), st.data())
203204
def test_setitem_masking(shape, data):
204205
x = data.draw(hh.arrays(xps.scalar_dtypes(), shape=shape), label="x")

array_api_tests/test_constants.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
from . import xp
88
from .typing import Array
99

10-
pytestmark = pytest.mark.ci
11-
1210

1311
def assert_scalar_float(name: str, c: Any):
1412
assert isinstance(c, SupportsFloat), f"{name}={c!r} does not look like a float"

array_api_tests/test_creation_functions.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from itertools import count
44
from typing import Iterator, NamedTuple, Union
55

6-
import pytest
76
from hypothesis import assume, given, note
87
from hypothesis import strategies as st
98

@@ -15,8 +14,6 @@
1514
from . import xps
1615
from .typing import DataType, Scalar
1716

18-
pytestmark = pytest.mark.ci
19-
2017

2118
class frange(NamedTuple):
2219
start: float

array_api_tests/test_data_type_functions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
from . import xp as _xp
1515
from .typing import DataType
1616

17-
pytestmark = pytest.mark.ci
18-
1917

2018
# TODO: test with complex dtypes
2119
def non_complex_dtypes():

array_api_tests/test_fft.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from . import xp
1818

1919
pytestmark = [
20-
pytest.mark.ci,
2120
pytest.mark.xp_extension("fft"),
2221
pytest.mark.min_version("2022.12"),
2322
]

array_api_tests/test_has_names.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
from .stubs import (array_attributes, array_methods, category_to_funcs,
1010
extension_to_funcs, EXTENSIONS)
1111

12-
pytestmark = pytest.mark.ci
13-
1412
has_name_params = []
1513
for ext, stubs in extension_to_funcs.items():
1614
for stub in stubs:

0 commit comments

Comments
 (0)