summaryrefslogtreecommitdiff
path: root/QMTest
diff options
context:
space:
mode:
authorDaniel Holth <dholth@fastmail.fm>2016-06-05 22:57:26 -0400
committerDaniel Holth <dholth@fastmail.fm>2016-06-05 22:57:26 -0400
commit1e9f3c6cdb393f9efa6934f50d200614d61e931d (patch)
treeacb5171a5115ebb8c67546d63c057099f4a49e15 /QMTest
parent5d1ccacdcdcafb310e2c07e520a7a381f40135e6 (diff)
downloadscons-1e9f3c6cdb393f9efa6934f50d200614d61e931d.tar.gz
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 2fba0a08..b0a456b9 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