summaryrefslogtreecommitdiffstats
path: root/QMTest
diff options
context:
space:
mode:
authorStefan Zimmermann <zimmermann.code@gmail.com>2013-12-27 09:39:26 (GMT)
committerStefan Zimmermann <zimmermann.code@gmail.com>2013-12-27 09:39:26 (GMT)
commitcbd2254037664fdfe6ba1bf6678896fbd51698a9 (patch)
tree2341eeaf2f6721e2a017e37df0cc48ad29ebe6e1 /QMTest
parent1a1a11122ad28df19d305af879ba79a2b08ce7d4 (diff)
downloadSCons-cbd2254037664fdfe6ba1bf6678896fbd51698a9.zip
SCons-cbd2254037664fdfe6ba1bf6678896fbd51698a9.tar.gz
SCons-cbd2254037664fdfe6ba1bf6678896fbd51698a9.tar.bz2
QMTest: open() in text mode. Add ()s to prints on writing test scripts from str.
Diffstat (limited to 'QMTest')
-rw-r--r--QMTest/SConscript4
-rw-r--r--QMTest/TestCmd.py6
2 files changed, 7 insertions, 3 deletions
diff --git a/QMTest/SConscript b/QMTest/SConscript
index 33fe903..5469d29 100644
--- a/QMTest/SConscript
+++ b/QMTest/SConscript
@@ -44,12 +44,12 @@ files = [
def copy(target, source, env):
t = str(target[0])
s = str(source[0])
- c = open(s, 'rb').read()
+ c = open(s, 'r').read()
# Note: We construct the __ VERSION __ substitution string at
# run-time so it doesn't get replaced when this file gets copied
# into the tree for packaging.
c = c.replace('__' + 'VERSION' + '__', env['VERSION'])
- open(t, 'wb').write(c)
+ open(t, 'w').write(c)
for file in files:
# Guarantee that real copies of these files always exist in
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index 488d940..c075cd3 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -287,6 +287,8 @@ version.
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
from __future__ import division, print_function
+from six import PY3
+
__author__ = "Steven Knight <knight at baldmt dot com>"
__revision__ = "TestCmd.py 1.3.D001 2010/06/03 12:58:27 knight"
__version__ = "1.3"
@@ -1705,7 +1707,7 @@ class TestCmd(object):
do_chmod(os.path.join(dirpath, name))
do_chmod(top)
- def write(self, file, content, mode = 'wb'):
+ def write(self, file, content, mode = 'w'):
"""Writes the specified content text (second argument) to the
specified file name (first argument). The file name may be
a list, in which case the elements are concatenated with the
@@ -1714,6 +1716,8 @@ class TestCmd(object):
exist. The I/O mode for the file may be specified; it must
begin with a 'w'. The default is 'wb' (binary write).
"""
+ if PY3:
+ content = re.sub('print (.+)', 'print(\1)', content)
file = self.canonicalize(file)
if mode[0] != 'w':
raise ValueError("mode must begin with 'w'")