Tino has proposed merging lp:~widelands-dev/widelands/python3 into lp:widelands.
Commit message: Add a compatibility layer to regression_test.py to allow running with python 2 and 3 Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #1566876 in widelands: "regression_test.py fails with Python 3.4.4" https://bugs.launchpad.net/widelands/+bug/1566876 For more details, see: https://code.launchpad.net/~widelands-dev/widelands/python3/+merge/291236 Add a compatibility layer to regression_test.py to allow running with python 2 and 3 -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/python3 into lp:widelands.
=== modified file 'regression_test.py' --- regression_test.py 2016-02-04 12:21:58 +0000 +++ regression_test.py 2016-04-07 11:51:58 +0000 @@ -12,6 +12,22 @@ import unittest import platform +#Python2/3 compat code for iterating items +try: + dict.iteritems +except AttributeError: + # Python 3 + def itervalues(d): + return iter(d.values()) + def iteritems(d): + return iter(d.items()) +else: + # Python 2 + def itervalues(d): + return d.itervalues() + def iteritems(d): + return d.iteritems() + def datadir(): return os.path.join(os.path.dirname(__file__), "data") @@ -76,7 +92,7 @@ '--disable_fx=true', '--disable_music=true', '--language=en_US' ] - args += [ "--%s=%s" % (key, value) for key, value in wlargs.iteritems() ] + args += [ "--%{}=%{}".format(key, value) for key, value in iteritems(wlargs) ] widelands = subprocess.Popen( args, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) @@ -214,7 +230,7 @@ args = parse_args() WidelandsTestCase.path_to_widelands_binary = args.binary - print "Using '%s' binary." % args.binary + print("Using '{}' binary.".format(args.binary)) WidelandsTestCase.do_use_random_directory = not args.nonrandom WidelandsTestCase.keep_output_around = args.keep_around
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp