-
Notifications
You must be signed in to change notification settings - Fork 25
Fix tests #83
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
Open
MarkKoz
wants to merge
23
commits into
niftools:develop
Choose a base branch
from
MarkKoz:fix_tests
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix tests #83
+721
−1,046
Conversation
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
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.
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.