Description
Tasks
- Doctest modules
- Enable --doctest-modules in pytest
- Failing modules
- Skipped modules (@djarecka: "I'll work on all of these")
- nibabel.tests.test_scripts
- nibabel.tests.test_spaces
- nibabel.tests.test_spatialimages
- nibabel.tests.test_spm2analyze
- nibabel.tests.test_spm99analyze
- nibabel.tests.test_testing
- nibabel.tests.test_tmpdirs
- nibabel.tests.test_trackvis
- nibabel.tests.test_tripwire
- nibabel.tests.test_viewers
- nibabel.tests.test_volumeutils
- Uncollected tests
- TEST: Refactor NetCDF tests to be more pytest friendly #879 @effigies
- nibabel/externals/tests/test_netcdf.py:48: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_read_write_files will be ignored
- nibabel/externals/tests/test_netcdf.py:89: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_read_write_sio will be ignored
- nibabel/externals/tests/test_netcdf.py:140: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_write_invalid_dtype will be ignored
- nibabel/tests/test_image_api.py:715: PytestCollectionWarning: cannot collect test class 'TestMinc2API' because it has a __init__ constructor
- nibabel/tests/test_scripts.py:104: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_nib_ls will be ignored
- nibabel/tests/test_scripts.py:187: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_nib_diff will be ignored
- TEST: Refactor NetCDF tests to be more pytest friendly #879 @effigies
- Untouched submodules
- nibabel.benchmarks
- nibabel.cifti2.tests
- nibabel.cmdline.tests
- nibabel.externals.tests
- nibabel.freesurfer.tests
- nibabel.gifti.tests
- nibabel.nicom.tests
- Refactors
- Skip base test cases like _TestWrapStructBase.
- Possible idea: use
setUp()
to test whether the class name starts with_
, andpytest.skip()
. - @effigies: TEST: Add BaseTestCase class to skip TestCases starting with
_
#871
- Possible idea: use
- Use
pytest.deprecated_call()
andpytest.warns()
instead ofclear_and_catch_warning
, when sensible. See TEST: Drop nose for pytest #865 (comment) and TEST: Drop nose for pytest #865 (comment).- Related: assert_warn_len_equal is kind of a mess, and made redundant with going Python 3+.
- Skip base test cases like _TestWrapStructBase.
Some principles:
- Try to avoid numpy test methods and decorators when a vanilla unittest/pytest construct exists. NOTABLE EXCEPTIONS: Tools for comparing arrays and floating points, such as
assert_almost_equal
. - Clear is better than brief.
- ...
Original post follows:
Summary
nose
is finally going to start failing on Python 3.9 due to some standard library API changes.
Python 3.9.0 is due to be released in October, but we might as well get out ahead of it. We don't need to rush, so I'm going to target the nibabel 3.1.0 release.
I put out a call on Twitter to see if anybody wanted to sprint on this, and got responses from @arokem, @chrisgorgo, @orduek, @robbisg and @anibalsolon (thanks to all for having the same handle on GitHub and Twitter).
This thread exists to coordinate the sprint.
Status
@djarecka and @chrisgorgo started on conversion in November:
- Ci/pytest nibabeltests #835
- adding testing_pytest that removed nose (it will be used temp. for te… #838
- converted test_volumeutils to pytest #839
- [wip] converting tests from nibabel/tests/ #840
There have been some changes in the tests since #840 was started, so it requires merging/rebasing.
Plans
To facilitate the transition, I've started the pytest
branch, which is #840's commits, rebased on master.
The first thing to do is to identify all remaining tasks. Off the top of my head we need to:
- Eliminate the use of
nose.tools
. - Move any nose test case classes to vanilla
unittest
features, which pytest should be able to handle transparently. - Verify coverage doesn't change/increases.
- Run doctests in the documentation with pytest.
Logistics
Let's set at least one definite window that people want to be actively working on this and where I can commit to being more responsive to keep things from stalling out. We don't all need to align, but it would probably be best for me if there isn't a separate window for each participant.
Would it be useful to attempt to do this (semi-)synchronously, and use a chat room? Or would people rather go through the usual process of creating issues and pull requests?