]> git.puffer.fish Git - matthieu/frr.git/commitdiff
topotests: python3, replace execfile with exec
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 25 Nov 2020 09:37:15 +0000 (09:37 +0000)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 25 Nov 2020 16:19:33 +0000 (16:19 +0000)
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 <philippe.guibert@6wind.com>
tests/topotests/lib/lutil.py

index 1fb4f48b0f12f76c2b595dad7db0a4e9182e346e..0b46363eddde24ed511d494f2dff8c0a2a772b49 100644 (file)
@@ -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)