-
Notifications
You must be signed in to change notification settings - Fork 297
Test Wrangling #4192
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
Test Wrangling #4192
Conversation
|
||
|
||
class TestMixin: | ||
class MergeMixin: |
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.
pytest
tried to run this as a test class, so errored all three tests when it couldn't find _data_path
. Removing "Test" from the class name stops pytest
trying to do that.
Found and added another missing |
Now |
Looks like it was the system tests that |
Back to the failures described in the OP: I think |
We previously used the cmp method to raise the error. But that is not a thing in python3. |
# behaviour (which compares using object IDs), so we raise | ||
# an exception here instead. | ||
fmt = "unable to compare PartialDateTime with {}" | ||
raise TypeError(fmt.format(type(other))) |
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 works but feels like a bit of a hack. Alternative solutions welcome!
|
||
class SystemInitialTest(tests.IrisTest): | ||
def system_test_supported_filetypes(self): | ||
def test_supported_filetypes(self): |
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.
pytest
requires test names to start with "test" or it just won't discover them
) | ||
|
||
def system_test_imports_general(self): | ||
def test_imports_general(self): |
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.
pytest
requires test names to start with "test"
pdt = PartialDateTime(month=3, microsecond=2) | ||
pdt = PartialDateTime(month=3, second=2) | ||
other = cftime.datetime(year=2013, month=3, day=20, second=2) | ||
self.assertTrue(pdt == other) |
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 was failing because the equality operator returned False
. Possibly cftime.datetime
s (or their predecessors) did not used to have a microseconds, but they do now.
@rcomer I'm trying to curate the There are a few PRs that need to land in the |
🚀 Pull Request
Description
I tried pointing
pytest
at Iris's tests and got 3 errors and 3 failures. The errors were easy to fix (see comment ontest_merge.py
). The failures are genuine, and it seems thattest_PartialDateTime
has not been running undersetuptools
ornox
. I've added an__init__.py
file to get those tests running. Now we need to decide whetherPartialDateTime
needs fixing or its tests need changing. The failures are:PartialDateTime() == 1
now returnsFalse
but aTypeError
is expected.PartialDateTime() != 1
now returnsTrue
but aTypeError
is expected.As far as I can tell,
PartialDateTime.__eq__
is returningNotImplemented
in the above.PartialDateTime(month=3, microsecond=2) == cftime.datetime(year=2013, month=3, day=20, second=2)
now returnsFalse
butTrue
is expected.The microsecond is ignored if
other
doesn't have that attribute. Didcftime.datetime
gain a microsecond attribute at some point?Anyone have an opinion on what the desired behaviour should be for the above cases?
Consult Iris pull request check list