diff options
Diffstat (limited to 'QMTest')
-rw-r--r-- | QMTest/TestCmd.py | 6 | ||||
-rw-r--r-- | QMTest/TestCommonTests.py | 13 | ||||
-rw-r--r-- | QMTest/TestSCons.py | 6 | ||||
-rw-r--r-- | QMTest/scons_tdb.py | 2 |
4 files changed, 15 insertions, 12 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 96e07a98..e76b2e31 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -499,7 +499,7 @@ def match_re(lines = None, res = None): msg = "Regular expression error in %s: %s" raise re.error(msg % (repr(s), e.args[0])) if not expr.search(lines[i]): - print("match_re: mismatch at line %d:\n search re='%s'\n line='%s'"%(i,s,lines[i])) + print("match_re: mismatch at line %d:\n search re='%s'\n line='%s'"%(i, s, lines[i])) return return 1 @@ -672,7 +672,7 @@ except AttributeError: PIPE = subprocess.PIPE -if sys.platform == 'win32' and subprocess.mswindows: +if sys.platform == 'win32':# and subprocess.mswindows: try: from win32file import ReadFile, WriteFile from win32pipe import PeekNamedPipe @@ -734,7 +734,7 @@ class Popen(subprocess.Popen): getattr(self, which).close() setattr(self, which, None) - if sys.platform == 'win32' and subprocess.mswindows: + if sys.platform == 'win32':# and subprocess.mswindows: def send(self, input): if not self.stdin: return None diff --git a/QMTest/TestCommonTests.py b/QMTest/TestCommonTests.py index 30b7d6a3..7949cb84 100644 --- a/QMTest/TestCommonTests.py +++ b/QMTest/TestCommonTests.py @@ -168,10 +168,11 @@ class __init__TestCase(TestCommonTestCase): os.chdir(run_env.workdir) script = lstrip("""\ + from __future__ import print_function from TestCommon import TestCommon tc = TestCommon(workdir='') import os - print os.getcwd() + print(os.getcwd()) """) run_env.run(program=sys.executable, stdin=script) stdout = run_env.stdout()[:-1] @@ -2285,14 +2286,16 @@ class variables_TestCase(TestCommonTestCase): 'dll_suffix', ] - script = "import TestCommon\n" + \ - '\n'.join([ "print TestCommon.%s\n" % v for v in variables ]) + script = "from __future__ import print_function" + \ + "import TestCommon\n" + \ + '\n'.join([ "print(TestCommon.%s)\n" % v for v in variables ]) run_env.run(program=sys.executable, stdin=script) stderr = run_env.stderr() assert stderr == "", stderr - script = "from TestCommon import *\n" + \ - '\n'.join([ "print %s" % v for v in variables ]) + script = "from __future__ import print_function" + \ + "from TestCommon import *\n" + \ + '\n'.join([ "print(%s)" % v for v in variables ]) run_env.run(program=sys.executable, stdin=script) stderr = run_env.stderr() assert stderr == "", stderr diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index e7175fbf..f75a3ccc 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -1239,7 +1239,7 @@ class TimeSCons(TestSCons): self.variables = kw.get('variables') default_calibrate_variables = [] if self.variables is not None: - for variable, value in list(self.variables.items()): + for variable, value in self.variables.items(): value = os.environ.get(variable, value) try: value = int(value) @@ -1295,7 +1295,7 @@ class TimeSCons(TestSCons): """ if 'options' not in kw and self.variables: options = [] - for variable, value in list(self.variables.items()): + for variable, value in self.variables.items(): options.append('%s=%s' % (variable, value)) kw['options'] = ' '.join(options) if self.calibrate: @@ -1321,7 +1321,7 @@ class TimeSCons(TestSCons): self.elapsed_time(), "seconds", sort=0) - for name, args in list(stats.items()): + for name, args in stats.items(): self.trace(name, trace, **args) def uptime(self): diff --git a/QMTest/scons_tdb.py b/QMTest/scons_tdb.py index f5c0ae51..76c7fe10 100644 --- a/QMTest/scons_tdb.py +++ b/QMTest/scons_tdb.py @@ -92,7 +92,7 @@ def get_explicit_arguments(e): # Determine which subset of the 'arguments' have been set # explicitly. explicit_arguments = {} - for name, field in list(arguments.items()): + for name, field in arguments.items(): # Do not record computed fields. if field.IsComputed(): continue |