@@ -178,13 +178,22 @@ By default, tests for the optional Array API extensions such as
178
178
will be skipped if not present in the specified array module. You can purposely
179
179
skip testing extension(s) via the ` --disable-extension ` option.
180
180
181
- #### Skip test cases
181
+ #### Skip or XFAIL test cases
182
182
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.
185
194
186
195
```
187
- # ./ skips.txt
196
+ # skips.txt or xfails .txt
188
197
# Line comments can be denoted with the hash symbol (#)
189
198
190
199
# 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)]
200
209
array_api_tests/test_set_functions.py
201
210
```
202
211
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 ` .
205
218
206
219
``` yaml
207
220
# ./.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
211
242
env :
212
243
ARRAY_API_TESTS_MODULE : your.array.api.namespace
213
244
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
226
248
` ` `
227
249
228
250
#### Max examples
0 commit comments