Open
Conversation
Nose seems to be broken with modern Python versions. nose-py3 may have worked, but may as well move to pytest at this point.
Expressions like "ARG / 3" are evaluated using Python's "/" operator. This is normal division, not floored division, so it may return a float.
Not sure if the warning is expected
I incorrectly treated nose's assert_true with two arguments as an equality assertion when converting to pytest. Turns out this test just made no sense to begin with.
The amount of children is still 4 because the nodes are set to None rather than removed from the children array. This wasn't caught before because the original test used assert_true(len(children), 2). The second argument is a custom message to show when the assertion fails. The intention was likely assert_equal.
Previously we had a customer runner for doctests which had some setup for exposing log messages to doctest. Now that we run them through pytest, the logs cannot be asserted in doctests. Need to figure out a way to expose logs again.
I don't know how to fix these right now. The CGF one is particularly confusing since it seems like the ELLIPSIS option for doctest isn't working only for that test.
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.
@niftools/pyffi-reviewer
Overview
The test suite had various problems. I wasn't able to run it on Python 3.14. The first order of business was to replace the unmaintained nose package with pytest. In this process, I caught some tests that were written incorrectly.
Doctests were running, but the results were not being checked or reported. I removed the custom doctest runner in favour of the pytest-doctestplus plugin. One thing we lose is the ability to assert log messages in doctest. There were only a handful of tests that relied on this, and I don't think too much value was lost from those tests. Moving forward, we should write tests in pytest if we need to assert logs.
I discovered several failing doctests. Some were due to bugs I was able to fix. Others I could not fix, and ended up disabling. My understanding is these tests have been broken for a long time, and were not caught because of incorrectly running the doctests.
Fixes Known Issues
None.
Documentation
Updated instructions in README for running tests.
Testing
Ran the full test suite.
Manual
None
Automated
Full test suite executed with pytest.
Additional Information
Bumped minimum Python version to 3.10. Anything lower is end of life.