Skip to content

Commit d7b184c

Browse files
committed
Document skips.txt
1 parent 0c7ec3a commit d7b184c

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

.github/workflows/numpy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
# https://github.com/numpy/numpy/issues/20870
3636
array_api_tests/test_data_type_functions.py::test_can_cast
3737
# The return dtype for trace is not consistent in the spec
38-
# (https://github.com/data-apis/array-api/issues/202#issuecomment-952529197)
38+
# https://github.com/data-apis/array-api/issues/202#issuecomment-952529197
3939
array_api_tests/test_linalg.py::test_trace
4040
# waiting on NumPy to allow/revert distinct NaNs for np.unique
4141
# https://github.com/numpy/numpy/issues/20326#issuecomment-1012380448

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,74 @@ library to fail.
151151

152152
### Configuration
153153

154+
#### CI flag
155+
154156
Use the `--ci` flag to run only the primary and special cases tests. You can
155157
ignore the other test cases as they are redundant for the purposes of checking
156158
compliance.
157159

160+
#### Extensions
161+
158162
By default, tests for the optional Array API extensions such as
159163
[`linalg`](https://data-apis.org/array-api/latest/extensions/linear_algebra_functions.html)
160164
will be skipped if not present in the specified array module. You can purposely
161165
skip testing extension(s) via the `--disable-extension` option.
162166

167+
#### Skip test cases
168+
169+
Test cases you want to skip can be specified in a `skips.txt` file in the root
170+
of this repository, e.g.:
171+
172+
```
173+
# ./skips.txt
174+
# Line comments can be denoted with the hash symbol (#)
175+
176+
# Skip specific test case, e.g. when argsort() does not respect relative order
177+
# https://github.com/numpy/numpy/issues/20778
178+
array_api_tests/test_sorting_functions.py::test_argsort
179+
180+
# Skip specific test case parameter, e.g. you forgot to implement in-place adds
181+
array_api_tests/test_add[__iadd__(x1, x2)]
182+
array_api_tests/test_add[__iadd__(x, s)]
183+
184+
# Skip module, e.g. when your set functions treat NaNs as non-distinct
185+
# https://github.com/numpy/numpy/issues/20326
186+
array_api_tests/test_set_functions.py
187+
```
188+
189+
For GitHub Actions, you might like to keep everything in the workflow config
190+
instead of having a seperate `skips.txt` file, e.g.:
191+
192+
```yaml
193+
# ./.github/workflows/array_api.yml
194+
...
195+
...
196+
- name: Run the test suite
197+
env:
198+
ARRAY_API_TESTS_MODULE: your.array.api.namespace
199+
run: |
200+
# Skip test cases with known issues
201+
cat << EOF >> skips.txt
202+
203+
# Skip specific test case, e.g. when argsort() does not respect relative order
204+
# https://github.com/numpy/numpy/issues/20778
205+
array_api_tests/test_sorting_functions.py::test_argsort
206+
207+
# Skip specific test case parameter, e.g. you forgot to implement in-place adds
208+
array_api_tests/test_add[__iadd__(x1, x2)]
209+
array_api_tests/test_add[__iadd__(x, s)]
210+
211+
# Skip module, e.g. when your set functions treat NaNs as non-distinct
212+
# https://github.com/numpy/numpy/issues/20326
213+
array_api_tests/test_set_functions.py
214+
215+
EOF
216+
217+
pytest -v -rxXfE --ci
218+
```
219+
220+
#### Max examples
221+
163222
The tests make heavy use
164223
[Hypothesis](https://hypothesis.readthedocs.io/en/latest/). You can configure
165224
how many examples are generated using the `--max-examples` flag, which defaults

0 commit comments

Comments
 (0)