Skip to content

TEST: Use more constrained mock when testing optpkg #983

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

Merged
merged 1 commit into from
Dec 21, 2020

Conversation

effigies
Copy link
Member

The existing mock raised errors on any import except a whitelisted unittest. Because old versions of pytest monkeypatched the Python interpreter and then performed imports within the patched functions, this breaks in Pytest 3.10. Move to an import that blacklists the specific module we're testing, which should be more resilient to test runner interference.

Fixes #982.

The existing mock raised errors on any import except a whitelisted
unittest. Because pytest monkeypatches the Python interpreter and then
performs imports within the patched functions, this breaks in Pytest
3.10. Move to an import that blacklists the specific module we're
testing.
@effigies effigies requested a review from yarikoptic December 20, 2020 17:17
@codecov
Copy link

codecov bot commented Dec 20, 2020

Codecov Report

Merging #983 (84c7cf4) into maint/3.2.x (a1a55ff) will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##           maint/3.2.x     #983      +/-   ##
===============================================
- Coverage        91.89%   91.85%   -0.04%     
===============================================
  Files              101      101              
  Lines            12550    12550              
  Branches          2209     2209              
===============================================
- Hits             11533    11528       -5     
- Misses             680      683       +3     
- Partials           337      339       +2     
Impacted Files Coverage Δ
nibabel/nifti1.py 92.10% <0.00%> (-0.46%) ⬇️
nibabel/volumeutils.py 84.13% <0.00%> (-0.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a1a55ff...84c7cf4. Read the comment docs.

@effigies
Copy link
Member Author

@yarikoptic Can you verify this resolves the error for you as well?

@yarikoptic
Copy link
Member

YES -- it resolved it, sorry forgot to follow up. I have uploaded fresh nibabel to debian and neurodebian with this PR patch. https://salsa.debian.org/med-team/nibabel/-/blob/master/debian/patches/983.patch

@effigies
Copy link
Member Author

Thanks. Merging.

@effigies effigies merged commit cb110b0 into nipy:maint/3.2.x Dec 21, 2020
@effigies effigies deleted the fix/optpkg_mock branch December 21, 2020 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants