Fix broken doctest and tests on accessors#46
Merged
weiji14 merged 4 commits intoxarray-contrib:mainfrom Jun 28, 2024
Merged
Conversation
Output type is now just `cupy.ndarray` instead of `cupy.core.core.ndarray`. Also updated pytest command in contributing.rst to include `--doctest-modules` flag.
dcherian
reviewed
Jun 25, 2024
cupy_xarray/tests/test_accessors.py
Outdated
Comment on lines
8
to
9
| dsk = DuckArrayModule("dask") | ||
| dask_array_type = dsk.type |
Contributor
There was a problem hiding this comment.
Let's just not do that
Suggested change
| dsk = DuckArrayModule("dask") | |
| dask_array_type = dsk.type | |
| try: | |
| import dask.array | |
| dask_array_type = dask.array.Array | |
| else: | |
| dask_array_type = None |
There is some new importlib way of doing this that I can't remember now
Member
Author
There was a problem hiding this comment.
Ok, done at 6229f99.
There is some new
importlibway of doing this that I can't remember now
Do you mean importlib.util.find_spec? That would allow us to get to the dask.array module, but not the dask.array.Array type. Unless there's another function I'm missing.
Contributor
There was a problem hiding this comment.
yeah that one but maybe it's not a big deal here/
Co-Authored-By: Deepak Cherian <dcherian@users.noreply.github.com>
dcherian
approved these changes
Jun 28, 2024
This was referenced Jun 28, 2024
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Couple of tests to fix when running
pytest --verbose --doctest-modules cupy_xarray:cupy_xarray.accessors.CupyDataArrayAccessor.as_cupy, output type should now becupy.ndarrayinstead ofcupy.core.core.ndarrayModuleNotFoundError: No module named 'xarray.core.pycompat'when running onxarray=2024.6.0. Need to apply a patch similar in concept to Fix broken dask_array_type import #24, but without importingxarray.core.pycompat(since it is a private function?). Specifically, change thefrom xarray.core.pycompat import dask_array_typeline to:Partially cherry-picked from #45. These changes will need to be tested locally with a CUDA GPU device for now, until we can get CI working somehow.