Skip to content

Commit 373d05f

Browse files
committed
Update the README for skips/xfails files
1 parent 153c9fa commit 373d05f

File tree

1 file changed

+43
-21
lines changed

1 file changed

+43
-21
lines changed

README.md

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,22 @@ By default, tests for the optional Array API extensions such as
178178
will be skipped if not present in the specified array module. You can purposely
179179
skip testing extension(s) via the `--disable-extension` option.
180180

181-
#### Skip test cases
181+
#### Skip or XFAIL test cases
182182

183-
Test cases you want to skip can be specified in a `skips.txt` file in the root
184-
of this repository, e.g.:
183+
Test cases you want to skip can be specified in a skips or XFAILS file. The
184+
difference between skip and XFAIL is that XFAIL tests are still run and
185+
reported as XPASS if they pass.
186+
187+
By default, the skips and xfails files are `skips.txt` and `fails.txt` in the root
188+
of this repository, but any file can be specified with the `--skips-file` and
189+
`--xfails-file` command line flags.
190+
191+
The files should list the test ids to be skipped/xfailed. Empty lines and
192+
lines starting with `#` are ignored. The test id can be any substring of the
193+
test ids to skip/xfail.
185194

186195
```
187-
# ./skips.txt
196+
# skips.txt or xfails.txt
188197
# Line comments can be denoted with the hash symbol (#)
189198
190199
# Skip specific test case, e.g. when argsort() does not respect relative order
@@ -200,29 +209,42 @@ array_api_tests/test_add[__iadd__(x, s)]
200209
array_api_tests/test_set_functions.py
201210
```
202211

203-
For GitHub Actions, you might like to keep everything in the workflow config
204-
instead of having a seperate `skips.txt` file, e.g.:
212+
Here is an example GitHub Actions workflow file, where the xfails are stored
213+
in `array-api-tests.xfails.txt` in the base of the `your-array-library` repo.
214+
215+
Note that this uses `-o xfail_strict=True`. This causes XPASS tests (XFAIL
216+
tests that actually pass) to fail the test suite. If you don't want this
217+
behavior, you can remove it, or use `--skips-file` instead of `--xfails-file`.
205218

206219
```yaml
207220
# ./.github/workflows/array_api.yml
208-
...
209-
...
210-
- name: Run the test suite
221+
jobs:
222+
tests:
223+
runs-on: ubuntu-latest
224+
strategy:
225+
matrix:
226+
python-version: ['3.8', '3.9', '3.10', '3.11']
227+
228+
steps:
229+
- name: Checkout <your array library>
230+
uses: actions/checkout@v3
231+
with:
232+
path: your-array-library
233+
234+
- name: Checkout array-api-tests
235+
uses: actions/checkout@v3
236+
with:
237+
repository: data-apis/array-api-tests
238+
submodules: 'true'
239+
path: array-api-tests
240+
241+
- name: Run the array API test suite
211242
env:
212243
ARRAY_API_TESTS_MODULE: your.array.api.namespace
213244
run: |
214-
# Skip test cases with known issues
215-
cat << EOF >> skips.txt
216-
217-
# Comments can still work here
218-
array_api_tests/test_sorting_functions.py::test_argsort
219-
array_api_tests/test_add[__iadd__(x1, x2)]
220-
array_api_tests/test_add[__iadd__(x, s)]
221-
array_api_tests/test_set_functions.py
222-
223-
EOF
224-
225-
pytest -v -rxXfE --ci
245+
export PYTHONPATH="${GITHUB_WORKSPACE}/array-api-compat"
246+
cd ${GITHUB_WORKSPACE}/array-api-tests
247+
pytest -v -rxXfE --ci -o xfail_strict=True --xfails-file ${GITHUB_WORKSPACE}/your-array-library/array-api-tests-xfails.txt
226248
```
227249
228250
#### Max examples

0 commit comments

Comments
 (0)