-
Notifications
You must be signed in to change notification settings - Fork 14
TST, CI: Skip platform dependent array API failures + adding windows and macOS env in CI #240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
prady0t
wants to merge
4
commits into
data-apis:main
Choose a base branch
from
prady0t:add-test-skips
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+17
−2
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4318e5b
Skip platform dependent array API failures
prady0t cf9cd80
Apply suggestions from code review
ev-br fe6145d
Adding windows and macos CI environments
prady0t 1864e72
Merge branch 'add-test-skips' of https://github.com/prady0t/array-api…
prady0t File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.pyfile? 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah maybe
pytest.mark.xfailis the way to go here. They even use platform as the example for that decorator :DThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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}.txtfiles 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
.txtfiles 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,
xfailsare be very expensive, and needlessly so, cf data-apis/array-api-compat#321There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't realise that the list of xfails is about tests from the
array-api-testsrepo, not tests that live in this repo.How about extending the
--xfails-fileargument 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 likepytest .. --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-strictThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" :-/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh this is a neat idea! Definitely much better than inventing a DSL for a single
xfails.txtfile and parsing it out the comments or something.To test-drive the idea, there are
--skips-file=...and--xfails-file=...already, so they can be reused :-).This would be a hack, of course, so longer term I agree it'd be better to be able to pass a semantically correct file multiple times. I haven't try to see how pytest handles these, but it should be very much doable I think.
Well, in the current setup the user keeps using semantically meaningful
--xfails-filename. There's an additional switch to toggle the internal details of how pytest and hypothesis handle an expected failure. This switch is obscure enough (an environment variable) to be only used deliberately, when pressed hard enough. An "anecdotal evidence" from https://github.com/data-apis/array-api-tests#turning-xfails-into-skips is real: we did manage to increase the number of examples by a factor of 4-5 and keep a reasonable tun time for some backends. And with hypothesis the number of examples is the measure of reliability: at some point Dask CI had 10 examples, and that meant it was effectively untested.