-
Notifications
You must be signed in to change notification settings - Fork 16
Description
lazy_xp_function
is quite effective for testing functions with backends that support lazy behavior. SciPy uses it within make_xp_pytest_marks
which generates the pytest marks for which backends to run tests on.
The PR scipy/scipy#23135 attempts to adapt SciPy's strategy for testing functions against alternative Python Array API standard compatible backends to some classes, including PPoly, and things almost work out of the box, with the exception of testing on lazy backends. This is because on dask lazy_xp_function
wraps its input with _dask_wrap, which replaces the class with a function (something similar happens with JAX and jax_autojit
) This resulted in the mysterious error here, scipy/scipy#23135 (comment).
For the time being, I think it's fine to just skip testing classes and their methods against lazy backends in SciPy, but longer term, it would be good to think about what should be done here. lazy_xp_class
if it existed, could call _dask_wrap
individually on methods. There's a question of whether you'd want separate CountingDaskScheduler
s per method, or one shared one per class or instance. I don't have strong opinions about how exactly things are done and haven't thought about it closely. I'm mainly making this issue to give somewhere to point to explain why classes in SciPy aren't being tested for lazy behavior, even if everything actually works, and to raise awareness.