Changeset 00fcc5d


Ignore:
Timestamp:
Nov 2, 2018, 7:03:01 PM (6 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:
5af36fa
Parents:
a3f2695
Message:

[tests] [win/osx] improve skipTest encoding errors on py2.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_note2midi.py

    ra3f2695 r00fcc5d  
    66from aubio import note2midi, freq2note, note2freq, float_type
    77from numpy.testing import TestCase
    8 from _tools import parametrize, assert_raises
     8from _tools import parametrize, assert_raises, skipTest
    99
    1010list_of_known_notes = (
     
    5454    @parametrize('note, midi', list_of_known_notes_with_unicode_issues)
    5555    def test_note2midi_known_values_with_unicode_issues(self, note, midi):
    56         " known values are correctly converted, unless decoding is expected to fail"
     56        " difficult values are correctly converted unless expected failure "
    5757        try:
    5858            assert note2midi(note) == midi
    5959        except UnicodeEncodeError as e:
     60            # platforms with decoding failures include:
     61            # - osx: python <= 2.7.10
     62            # - win: python <= 2.7.12
    6063            import sys
    61             strfmt = "len(u'\\U0001D12A') != 1, excpected decoding failure | {:s} | {:s} {:s}"
    62             strres = strfmt.format(e, sys.platform, sys.version)
    63             # happens with: darwin 2.7.10, windows 2.7.12
     64            strmsg = "len(u'\\U0001D12A') != 1, expected decoding failure"
     65            strmsg += " | upgrade to Python 3 to fix"
     66            strmsg += " | {:s} | {:s} {:s}"
    6467            if len('\U0001D12A') != 1 and sys.version[0] == '2':
    65                 skipTest(strres + " | upgrade to Python 3 to fix")
     68                skipTest(strmsg.format(repr(e), sys.platform, sys.version))
    6669            else:
    6770                raise
     
    136139
    137140if __name__ == '__main__':
    138     from unittest import main
    139     main()
     141    import sys, pytest
     142    pytest.main(sys.argv)
Note: See TracChangeset for help on using the changeset viewer.