RF: Centralize import of decorators from numpy.testing#738
RF: Centralize import of decorators from numpy.testing#738effigies merged 3 commits intonipy:masterfrom
Conversation
I kept receiving messages that imports from numpy.testing.decorators are deprecated (since 1.5 IIRC), so I found that some places still import them in the test files instead of centraly from nibabel.testing which already provides imports adaptor. So I RFed to avoid such imports, and moved a stub for @slow there too
effigies
left a comment
There was a problem hiding this comment.
This looks reasonable. I'll try to look at the test failures...
nibabel/testing/__init__.py
Outdated
| except ImportError: | ||
| from numpy.testing.decorators import skipif | ||
|
|
||
| # Recent (1.2) versions of numpy have this decorator |
There was a problem hiding this comment.
We have a minimum version of 1.7.1. I don't think this is guard is necessary anymore.
|
Oh, the test failure is just the usual AppVeyor nonsense. I thought there was a problem with a recent version of matplotlib. Might be thinking of another project. |
Codecov Report
@@ Coverage Diff @@
## master #738 +/- ##
==========================================
- Coverage 89.39% 86.24% -3.15%
==========================================
Files 93 93
Lines 11476 11474 -2
Branches 1992 1992
==========================================
- Hits 10259 9896 -363
- Misses 881 1252 +371
+ Partials 336 326 -10
Continue to review full report at Codecov.
|
nibabel/testing/__init__.py
Outdated
| slow = dec.slow | ||
| except ImportError: | ||
| from numpy.testing.decorators import skipif | ||
| from numpy.testing.decorators import (skipif, slow) |
There was a problem hiding this comment.
Something's weird with the testing because this is never getting hit, even on the numpy==1.7.1 build. See 2007.5, here:
https://codecov.io/gh/nipy/nibabel/commit/0c36551c7398dcfb132fe4ce37b115c23d183b72/build
I know it's not really relevant to this PR, but any thoughts? I checked the travis log, and see no indication that anything other than 1.7.1 was installed.
There was a problem hiding this comment.
No immediate idea, I am away from the laptop ATM, but if I were with it I would remove try/except and see how it fails
There was a problem hiding this comment.
Ah, it's because numpy.testing.dec has existed forever. It's just an alias of an imported module, and the module it's aliasing has changed from numpy.testing.decorators to numpy.testing._private.decorators.
How about we just drop the try/except bit, and load dec, skipif, and slow?
I kept receiving messages that imports from numpy.testing.decorators are
deprecated (since 1.5 IIRC), so I found that some places still import them
in the test files instead of centraly from nibabel.testing which already
provides imports adaptor. So I RFed to avoid such imports, and moved a
stub for @slow there too