Description
The test suite is mostly made up of test methods for each function (or array object method) in the spec. The majority of these tests require other functions to do everything we want, which is problematic when an underlying function does not work—you'll get a lot of spammy errors that actually relate to a single fundamental problem... or even false positives.
So I think it would be a good idea if we declared the dependencies of each test method, i.e. the functions we use and assume has correct behaviour. We could use these declarations to create a dependency graph, which could be hooked with pytest to prioritise zero/low-dependency tests first, and by default skipping tests that use functions we've deemed incorrect. This will benefit:
- Array API adoptors, who would much more easily see what they should prioritise developing
- Us, who'd be able to see areas where we can try to cut down the functions we depend on
Ideas for declaring dependencies per test method:
- Decorator which lists function and method names
- Automatically infer dependencies via looking at function code (either searching the code as string, or using the AST)
General challenges would be:
- How to get pytests collection hook to do this
- Supporting array object methods alongside the top-level functions
- As well as operator symbols
The dependency graph + auto skipping would also allow us to:
- Remove some mirrored functions in
array_helpers
- Remove the module stubbing mechanism
- Check that no tests is using the function they're testing for assertions