diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2015-12-23 22:37:42 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2015-12-23 22:59:37 +0100 |
commit | 32215996528779f71a636350a36c01a8b3ccb1bf (patch) | |
tree | 09cc4fbf2f0cebd99de073aa9edc6c572c1cda96 /testsuite/driver/testlib.py | |
parent | 7cddcde52cf27c55223b1dbb995df623498d0f70 (diff) | |
download | haskell-32215996528779f71a636350a36c01a8b3ccb1bf.tar.gz |
Make testsuite work again with Py3
Python 3 support seems to have mildly bitrotten since #9184 was closed.
Luckily, only some minor tweaks seem necessary.
Diffstat (limited to 'testsuite/driver/testlib.py')
-rw-r--r-- | testsuite/driver/testlib.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 4e9a1fbfa4..33e134d857 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -23,6 +23,11 @@ import subprocess from testglobals import * from testutil import * +try: + basestring +except: # Python 3 + basestring = (str,bytes) + if config.use_threads: import threading try: @@ -691,8 +696,8 @@ def test_common_work (name, opts, func, args): elif config.speed > 0: # However, if we EXPLICITLY asked for a way (with extra_ways) # please test it! - explicit_ways = filter(lambda way: way in opts.extra_ways, do_ways) - other_ways = filter(lambda way: way not in opts.extra_ways, do_ways) + explicit_ways = list(filter(lambda way: way in opts.extra_ways, do_ways)) + other_ways = list(filter(lambda way: way not in opts.extra_ways, do_ways)) do_ways = other_ways[:1] + explicit_ways if not config.clean_only: @@ -1721,7 +1726,7 @@ def normalise_errmsg( str ): # Also filter out bullet characters. This is because bullets are used to # separate error sections, and tests shouldn't be sensitive to how the # the division happens. - bullet = u'•'.encode('utf8') + bullet = u'•'.encode('utf8') if isinstance(str, bytes) else u'•' str = str.replace(bullet, '') return str |