-
Notifications
You must be signed in to change notification settings - Fork 9
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
gh-439: infrastructure for testing array API compatibility #459
base: main
Are you sure you want to change the base?
Conversation
527afdc
to
65223c0
Compare
pre-commit.ci autofix |
@paddyroddy @ntessore this should be ready for review. See the infrastructure in action in #423 - |
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.
Looks great! Have you got a link to what SciPy do?
# use this as a decorator for tests involving array API compatible functions | ||
array_api_compatible = pytest.mark.parametrize("xp", xp_available_backends.values()) |
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.
I wonder if all of this stuff should go in its own file, so that only this line features here?
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.
In my opinion all the common testing utilities should go directly into conftest.py
because that is the sole use of this file (even if it gets crowded).
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.
Fair enough. I'm just concerned that it can make it harder for others to contribute. Would be good for it to be as neat and granular as possible.
Here it is - https://github.com/scipy/scipy/blob/36e349b6afbea057cb713fc314296f10d55194cc/scipy/conftest.py#L139 They have loads of utility functions defined in that section that we might need someday in the future. Maybe I should link this in the file for future reference. |
Fantastic effort @Saransh-cpp! Only one question: why aren't we testing with numpy? |
Yeah I think that would be a good idea |
We are! The screenshot above does not show the |
Oh, I see: it's not in the default ARRAY_BACKENDS list but added in the processing of "all", got it! Fantastic! |
Ah, yes, for noxfile - given that we are already installing numpy as part of |
Co-authored-by: Patrick J. Roddy <[email protected]>
fa75b7a
to
1b0d92b
Compare
Inspired heavily from SciPy's infrastructure, this PR adds a way to test array API compatibility (more specifically,
array_api_strict
andjax
, which can be easily scaled to other libraries in the future).SciPy does in fact test its functions on every supported array library, instead of just relying on
array_api_strict
.array_api_strict
will test the shared functionality, but will fail to identify functionalities which are not standardized and where libraries deviate from each other (such as immutability injax
); hence, testing with every library sounds like a good idea.Closes: #439