feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/timestretchfix/ffmpeg5
Last change
on this file since 548f60d was
7318485,
checked in by Paul Brossier <piem@piem.org>, 6 years ago
|
[py] remove nose2
|
-
Property mode set to
100644
|
File size:
826 bytes
|
Rev | Line | |
---|
[98972b9] | 1 | """ |
---|
| 2 | This file imports test methods from different testing modules, in this |
---|
| 3 | order: |
---|
| 4 | |
---|
[7318485] | 5 | - try importing 'pytest' |
---|
| 6 | - if it fails, fallback to 'numpy.testing' |
---|
| 7 | |
---|
| 8 | Nose2 support was removed because of lacking assertWarns on py2.7. |
---|
| 9 | |
---|
[98972b9] | 10 | """ |
---|
| 11 | |
---|
| 12 | import sys |
---|
| 13 | |
---|
| 14 | _has_pytest = False |
---|
[7318485] | 15 | |
---|
| 16 | # check if we have pytest |
---|
| 17 | try: |
---|
| 18 | import pytest |
---|
| 19 | parametrize = pytest.mark.parametrize |
---|
| 20 | assert_raises = pytest.raises |
---|
| 21 | assert_warns = pytest.warns |
---|
| 22 | skipTest = pytest.skip |
---|
| 23 | _has_pytest = True |
---|
| 24 | except: |
---|
| 25 | pass |
---|
[98972b9] | 26 | |
---|
| 27 | # otherwise fallback on numpy.testing |
---|
[7318485] | 28 | if not _has_pytest: |
---|
[98972b9] | 29 | from numpy.testing import dec, assert_raises, assert_warns |
---|
| 30 | from numpy.testing import SkipTest |
---|
| 31 | parametrize = dec.parametrize |
---|
| 32 | def skipTest(msg): |
---|
| 33 | raise SkipTest(msg) |
---|
| 34 | |
---|
| 35 | # always use numpy's assert_equal |
---|
| 36 | import numpy |
---|
| 37 | assert_equal = numpy.testing.assert_equal |
---|
Note: See
TracBrowser
for help on using the repository browser.