summaryrefslogtreecommitdiffstats
path: root/QMTest
diff options
context:
space:
mode:
authorDaniel Holth <dholth@fastmail.fm>2016-06-06 02:57:26 (GMT)
committerDaniel Holth <dholth@fastmail.fm>2016-06-06 02:57:26 (GMT)
commit3128ce66f69ee2be54080caea8d86f817885616b (patch)
treeacb5171a5115ebb8c67546d63c057099f4a49e15 /QMTest
parente4b799e8dc348159c5f2d70bdf49819c4d8270bc (diff)
downloadSCons-3128ce66f69ee2be54080caea8d86f817885616b.zip
SCons-3128ce66f69ee2be54080caea8d86f817885616b.tar.gz
SCons-3128ce66f69ee2be54080caea8d86f817885616b.tar.bz2
fix some tests for pypy
The major category of broken test is that which depends on garbage collection to flush and close an open file. Also, the empty list is apparently not a singleton in pypy.
Diffstat (limited to 'QMTest')
-rw-r--r--QMTest/TestCmd.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index 2fba0a0..b0a456b 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -1731,11 +1731,12 @@ class TestCmd(object):
file = self.canonicalize(file)
if mode[0] != 'w':
raise ValueError("mode must begin with 'w'")
- try:
- open(file, mode).write(content)
- except TypeError as e:
- # python 3 default strings are not bytes, but unicode
- open(file, mode).write(bytes(content,'utf-8'))
+ with open(file, mode) as f:
+ try:
+ f.write(content)
+ except TypeError as e:
+ # python 3 default strings are not bytes, but unicode
+ f.write(bytes(content,'utf-8'))
# Local Variables:
# tab-width:4