Changeset 7318485 for python/tests


Ignore:
Timestamp:
Nov 2, 2018, 6:01:52 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
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
Message:

[py] remove nose2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/_tools.py

    r9a1df7f r7318485  
    33order:
    44
    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
     8Nose2 support was removed because of lacking assertWarns on py2.7.
     9
    810"""
    911
     
    1113
    1214_has_pytest = False
    13 _has_nose2 = False
    1415
    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
     17try:
     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
     24except:
     25    pass
    3626
    3727# otherwise fallback on numpy.testing
    38 if not _has_pytest and not _has_nose2:
     28if not _has_pytest:
    3929    from numpy.testing import dec, assert_raises, assert_warns
    4030    from numpy.testing import SkipTest
Note: See TracChangeset for help on using the changeset viewer.