qsiprep icon indicating copy to clipboard operation
qsiprep copied to clipboard

Enable doctests

Open tsalo opened this issue 10 months ago • 8 comments

Closes none.

Changes proposed in this pull request

  • Create a separate CircleCI job to run doctests, which should improve test coverage.

tsalo avatar Feb 24 '25 19:02 tsalo

The only failing doctests now are ones we want to pass, so I think I can transition from getting the workflow configured to fixing up the actual tests.

tsalo avatar Aug 05 '25 16:08 tsalo

There is a mismatch between the expected behavior of the doctest in get_highest_priority_fieldmap and its actual behavior:

https://github.com/PennLINC/qsiprep/blob/317828fe70ea8be7a6fe7b5f86bb521902c5f503/qsiprep/utils/grouping.py#L257-L259

Expected:
    {'suffix': 'epi', 'epi': ['/data/sub-1/fmap/sub-1_dir-AP_run-1_epi.nii.gz']}
Got:
    {'suffix': 'dwi', 'dwi': ['/data/sub-1/dwi/sub-1_dir-AP_run-1_dwi.nii.gz', '/data/sub-1/dwi/sub-1_dir-AP_run-2_dwi.nii.gz', '/data/sub-1/dwi/sub-1_dir-AP_run-3_dwi.nii.gz']}

We expect the EPI field map to be used, but the rpe DWI file is selected instead. @mattcieslak any ideas?

tsalo avatar Aug 05 '25 19:08 tsalo

I think we would want to use the dwi instead of the epi if there is a dwi available that can be used for distortion correction

mattcieslak avatar Aug 06 '25 14:08 mattcieslak

Sounds good. I changed the documentation and test to reflect that.

tsalo avatar Aug 06 '25 14:08 tsalo

doctests are now passing 🎉

tsalo avatar Aug 06 '25 16:08 tsalo

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 48.27%. Comparing base (317828f) to head (db2306e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #926      +/-   ##
==========================================
+ Coverage   46.02%   48.27%   +2.25%     
==========================================
  Files          65       65              
  Lines        9764     9764              
  Branches     1074     1074              
==========================================
+ Hits         4494     4714     +220     
+ Misses       5044     4831     -213     
+ Partials      226      219       -7     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Aug 06 '25 17:08 codecov-commenter

nice little coverage bump too

tsalo avatar Aug 06 '25 17:08 tsalo

I'm not sure why tests were passing before TBH. The current failure is due to missing datasets, which makes sense.

tsalo avatar Aug 07 '25 18:08 tsalo