summaryrefslogtreecommitdiff
path: root/tests/topotests/lib/lutil.py
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-11-25 14:22:10 -0500
committerGitHub <noreply@github.com>2020-11-25 14:22:10 -0500
commit3abf06b722c83c47255a9e1245770f55b17f2d38 (patch)
tree26ea6a0bacb7866f1475a77c70bff6bba76d75e0 /tests/topotests/lib/lutil.py
parent68cd847ee68e8b62d079cb0c683848ad87bdf6ee (diff)
parent10870bbc206f79dc125f33fe6962fe2ac873ada1 (diff)
Merge pull request #7607 from pguibert6WIND/topo_python3_preparation
Topo python3 preparation
Diffstat (limited to 'tests/topotests/lib/lutil.py')
-rw-r--r--tests/topotests/lib/lutil.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/topotests/lib/lutil.py b/tests/topotests/lib/lutil.py
index 1fb4f48b0f..9cbea67af1 100644
--- a/tests/topotests/lib/lutil.py
+++ b/tests/topotests/lib/lutil.py
@@ -23,7 +23,7 @@ import time
import datetime
import json
import math
-from topolog import logger
+from lib.topolog import logger
from mininet.net import Mininet
@@ -58,14 +58,14 @@ class lUtil:
def log(self, str, level=6):
if self.l_level > 0:
if self.fout == "":
- self.fout = open(self.fout_name, "w", 0)
+ self.fout = open(self.fout_name, "w")
self.fout.write(str + "\n")
if level <= self.l_level:
print(str)
def summary(self, str):
if self.fsum == "":
- self.fsum = open(self.fsum_name, "w", 0)
+ self.fsum = open(self.fsum_name, "w")
self.fsum.write(
"\
******************************************************************************\n"
@@ -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)