From: Philippe Guibert Date: Wed, 25 Nov 2020 09:37:15 +0000 (+0000) Subject: topotests: python3, replace execfile with exec X-Git-Tag: base_7.6~205^2~4 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=6cb6c403f1895553d8637c0e8d219cd632455403;p=matthieu%2Ffrr.git topotests: python3, replace execfile with exec python3 does not support execfile implementation. replace it with open and exec api that are available in both python 2 and 3 implementations. Signed-off-by: Philippe Guibert --- diff --git a/tests/topotests/lib/lutil.py b/tests/topotests/lib/lutil.py index 1fb4f48b0f..0b46363edd 100644 --- a/tests/topotests/lib/lutil.py +++ b/tests/topotests/lib/lutil.py @@ -380,7 +380,8 @@ def luInclude(filename, CallOnFail=None): LUtil.setCallOnFail(CallOnFail) if filename.endswith(".py"): LUtil.log("luInclude: execfile " + tstFile) - execfile(tstFile) + with open(tstFile) as infile: + exec(infile.read()) else: LUtil.log("luInclude: execTestFile " + tstFile) LUtil.execTestFile(tstFile)