-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
pytest-ification #1828
pytest-ification #1828
Conversation
54dc125
to
8302c24
Compare
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.
Thanks @maxim-lian,
This is a great step to clean up our test suit :)
Are you going to make our tests more pytest-ized (e.g. by adopting more @pytest.mark.parametrize
)?
I think the current change is a good size.
There are some test failures (maybe due to mis-import).
After they are fixed, I will review more carefully and merge this so that this change would not be outdated.
xarray/tests/__init__.py
Outdated
@@ -109,12 +109,6 @@ def _importorskip(modname, minversion=None): | |||
|
|||
|
|||
class TestCase(unittest.TestCase): | |||
if PY3: |
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.
Maybe we can remove from xarray.core.pycompat import PY3
in line 3.
b5abf05
to
9fc243b
Compare
I think this is now passing throughout except for Python3.4, which I think is because pytest is on version 3.0.5, which doesn't have the Does anyone know why an old version of pytest is being installed there? From what I can see on the pytest home page, 3.4 is fully supported, and the 3.4 ci requirements don't force a lower version of pytest. I could unravel that but if anyone has insight (and is anyone using 3.4? Though this PR prob not the place to make that decision) I think we should try and merge this asap, as there are going to be (manageable) merge conflicts with other branches |
Not yet, I think that's a bigger exercise, and more difficult to script |
c2b5aad
to
ee4443e
Compare
This reverts commit fa8f89a.
ee4443e
to
71b34f9
Compare
xarray/core/dtypes.py
Outdated
fill_value = np.nan | ||
elif np.issubdtype(dtype, int): | ||
elif np.issubdtype(dtype, np.signedinteger): |
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.
This should also apply to unsigned integers, and the resulting dtype should be given as a numpy dtype. Plus, we can make this much more efficient for small integers:
elif np.issubdtype(dtype, np.integer):
if dtype.itemsize <= 2:
dtype = np.float32
else:
dtype = np.float64
fill_value = np.nan
Tests now pass, including flake8, apart from the pytest.warns. Given how much code this touches, I'm keen to merge this ASAP, before divergences creep in. What's the best course on 3.4? pandas is in the process of dropping it. Alternatively I could revert the |
@maxim-lian - I opened #1829 to discuss dropping Python 3.4. |
Using pip seems to temporary solve this issue.
maybe not the best solution, though. |
There are two comment-outed lines using We are still using some methods of |
That are comment-out as part of this PR? Or prior? If prior, then I think we should leave until we attempt to add those back in
I think the best way of handling those is xfailing an |
Nice, thanks. I've put this in. If we're on the way to deprecate 3.4, from which source we install pytest is flexible IMHO |
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.
This looks good to me. Thanks for the cleanup.
So far, only the changes that
unittest2pytest
could fix. Need to work out how to sort through the exisiting xarray onesEDIT: ready to merge (and keen to get this in before there are divergences from other branches)