TST, CI: Skip platform dependent array API failures + adding windows and macOS env in CI - #240
TST, CI: Skip platform dependent array API failures + adding windows and macOS env in CI#240prady0t wants to merge 4 commits into
Conversation
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Co-authored-by: Evgeni Burovski <evgeny.burovskiy@gmail.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
…-strict into add-test-skips
|
Ah, you're adding the new CI runs here... because I did not press the green button. OK, let's carry on in this PR then. |
|
Two new failures in CI macOS: Windows: |
|
On my machine (macOS 26.5.1) it passed For test on windows:
|
| array_api_tests/test_dlpack.py::test_from_dlpack | ||
|
|
||
| # https://github.com/numpy/numpy/issues/32234 : macOS specific failures | ||
| array_api_tests/test_special_cases.py::test_unary[atanh(real(x_i) is +0 and imag(x_i) is NaN) -> +0 + NaN j] |
There was a problem hiding this comment.
For my education: how does the xfail machinery know that these tests should only be xfailed on macOS?
If possible, it would be good to not have a list of xfails that is "optional" (if it passes that is fine, if it fails that is also fine). In pytest there is a "strict" mode for xfails where something that is marked as failing but passes is a failure (🔴 ➡️ 🟢 ➡️ 🔴 - good luck not getting confused :D) . Maybe it is beyond the scope of this PR to get array-api-strict to run in strict mode, but we should aim for that ideal state. So we should briefly consider it here for OS dependent xfails.
There was a problem hiding this comment.
For my education: how does the xfail machinery know that these tests should only be xfailed on macOS?
It doesn't; it loosely expects it to fall evrywhere. Yes, if we use --strict, it would raise an error if it passes.
Maybe we can modify test collection behaviour in the contest.py file? Or, use something like:
@pytest.mark.skipif(sys.platform == "the platform")On the tests that are failing specifically on certain platforms.
There was a problem hiding this comment.
Yeah maybe pytest.mark.xfail is the way to go here. They even use platform as the example for that decorator :D
There was a problem hiding this comment.
I'd have a rather strong desire to keep all xfails/skips in the same file. Tests themselves are in a different repository (array-api-tests), are reused across multiple array libraries, and themselves have zero pytest.mark.{skip, xfail} markers. All skipping/failing is done via these text files, and is specific to array libraries (compare to -{xfail,skip}.txt files in https://github.com/data-apis/array-api-compat).
Moreover, whether entries in a file are skips or xfails is controllable at the test suite invocation time by an environment variable [1].
IOW, whether to skip a test or not is a decision of whoever runs the test suite, when they run the test suite.
Therefore, if we are seriously looking to enable platform dependence, we need a DSL for the .txt files themselves. Currently, there isn't one, and the whole logic is here:
https://github.com/data-apis/array-api-tests/blob/master/conftest.py#L166-L200
[1] this is important from performance POV: with hypothesis, xfails are be very expensive, and needlessly so, cf data-apis/array-api-compat#321
There was a problem hiding this comment.
Ah, I didn't realise that the list of xfails is about tests from the array-api-tests repo, not tests that live in this repo.
How about extending the --xfails-file argument so that it can be passed multiple times? Then we can maintain a file that contains xfails that apply to all platforms and one each per platform that contains tests that only xfail on that platform. Something like pytest .. --xfails-file general-xfails.txt --xfails-file macos-only-xfails.txt ? I've not poked around pytest's arg handling enough to know if it support it. Otherwise we might need a recipe for combining two files into one on the fly. We could document this in this (array-api-strict) repo for those who want to invoke the array-api-tests tests on array-api-strict
There was a problem hiding this comment.
I'm a hypothesis luddite, so I have nothing useful to say about the "use skips even if you mean xfail because xfails make things slow" :-/
Closes: #238