Conversation
|
|
||
|
|
||
| class TestMixin: | ||
| class MergeMixin: |
There was a problem hiding this comment.
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.
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.
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.
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.
This was failing because the equality operator returned False. Possibly cftime.datetimes (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
pytestat 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_PartialDateTimehas not been running undersetuptoolsornox. I've added an__init__.pyfile to get those tests running. Now we need to decide whetherPartialDateTimeneeds fixing or its tests need changing. The failures are:PartialDateTime() == 1now returnsFalsebut aTypeErroris expected.PartialDateTime() != 1now returnsTruebut aTypeErroris expected.As far as I can tell,
PartialDateTime.__eq__is returningNotImplementedin the above.PartialDateTime(month=3, microsecond=2) == cftime.datetime(year=2013, month=3, day=20, second=2)now returnsFalsebutTrueis expected.The microsecond is ignored if
otherdoesn't have that attribute. Didcftime.datetimegain 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