Changeset 7318485
- Timestamp:
- Nov 2, 2018, 6:01:52 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
- Children:
- 0cc8514
- Parents:
- 9a1df7f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/tests/_tools.py
r9a1df7f r7318485 3 3 order: 4 4 5 - if 'nose2' is found in the list of loaded module, use it 6 - otherwise, try using 'pytest' 7 - if that also fails, fallback to 'numpy.testing' 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 8 10 """ 9 11 … … 11 13 12 14 _has_pytest = False 13 _has_nose2 = False14 15 15 # if nose2 has already been imported, use it 16 if 'nose2' in sys.modules: 17 from nose2.tools import params, such 18 def parametrize(argnames, argvalues): 19 return params(*argvalues) 20 assert_raises = such.helper.assertRaises 21 assert_warns = such.helper.assertWarns 22 skipTest = such.helper.skipTest 23 _has_nose2 = True 24 25 # otherwise, check if we have pytest 26 if not _has_nose2: 27 try: 28 import pytest 29 parametrize = pytest.mark.parametrize 30 assert_raises = pytest.raises 31 assert_warns = pytest.warns 32 skipTest = pytest.skip 33 _has_pytest = True 34 except: 35 pass 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 36 26 37 27 # otherwise fallback on numpy.testing 38 if not _has_pytest and not _has_nose2:28 if not _has_pytest: 39 29 from numpy.testing import dec, assert_raises, assert_warns 40 30 from numpy.testing import SkipTest
Note: See TracChangeset
for help on using the changeset viewer.