mirror of
https://github.com/godotengine/buildroot.git
synced 2026-01-05 14:09:53 +03:00
support/testing: fix python syntax
Fix three issues with code style in our test infra: - 'print' is now a function, - exceptions need to be caught-assigned with the 'as' keyword, - old-style "%s"%() formatting is deprecated. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com> [Thomas: drop indices in format strings.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
a1f4421cc7
commit
99723554c0
@@ -34,17 +34,17 @@ def download(dldir, filename):
|
||||
os.makedirs(dldir)
|
||||
|
||||
tmpfile = tempfile.mktemp(dir=dldir)
|
||||
print "Downloading to {}".format(tmpfile)
|
||||
print("Downloading to {}".format(tmpfile))
|
||||
|
||||
try:
|
||||
url_fh = urlopen(os.path.join(ARTIFACTS_URL, filename))
|
||||
with open(tmpfile, "w+") as tmpfile_fh:
|
||||
tmpfile_fh.write(url_fh.read())
|
||||
except (HTTPError, URLError), err:
|
||||
except (HTTPError, URLError) as err:
|
||||
os.unlink(tmpfile)
|
||||
raise err
|
||||
|
||||
print "Renaming from %s to %s" % (tmpfile, finalpath)
|
||||
print("Renaming from {} to {}".format(tmpfile, finalpath))
|
||||
os.rename(tmpfile, finalpath)
|
||||
return finalpath
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ class BRTest(unittest.TestCase):
|
||||
self.config += "\nBR2_JLEVEL={}\n".format(self.jlevel)
|
||||
|
||||
def show_msg(self, msg):
|
||||
print "{} {:40s} {}".format(datetime.datetime.now().strftime("%H:%M:%S"),
|
||||
self.testname, msg)
|
||||
print("{} {:40s} {}".format(datetime.datetime.now().strftime("%H:%M:%S"),
|
||||
self.testname, msg))
|
||||
|
||||
def setUp(self):
|
||||
self.show_msg("Starting")
|
||||
|
||||
Reference in New Issue
Block a user