summaryrefslogtreecommitdiffstats
path: root/test/Batch
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2019-05-29 13:49:22 (GMT)
committerMats Wichmann <mats@linux.com>2019-05-30 12:48:08 (GMT)
commitc2cf24a5be13852cc65c4a9071f52f2715bc409c (patch)
tree4bf14f6159e40ec89b5517268878294475612f65 /test/Batch
parent886af259720ca20e1473ebe5cc5a919422f3b85d (diff)
downloadSCons-c2cf24a5be13852cc65c4a9071f52f2715bc409c.zip
SCons-c2cf24a5be13852cc65c4a9071f52f2715bc409c.tar.gz
SCons-c2cf24a5be13852cc65c4a9071f52f2715bc409c.tar.bz2
Tweak a few tests
"for i in range(len(foo))" idiom changed to iterate directly over lists instead of indexing them. zip() generates the iterator in the case with two lists. reversed() used for the Windows drive-letter test. gdbm is not gone, just renamed. change test to find under either name. Use a context manager for closing StringIO objects opened for capturing standard I/O streams. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/Batch')
-rw-r--r--test/Batch/action-changed.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/test/Batch/action-changed.py b/test/Batch/action-changed.py
index 777c7fb..b2b1673 100644
--- a/test/Batch/action-changed.py
+++ b/test/Batch/action-changed.py
@@ -43,12 +43,10 @@ import sys
sep = sys.argv.index('--')
targets = sys.argv[1:sep]
sources = sys.argv[sep+1:]
-for i in range(len(targets)):
- t = targets[i]
- s = sources[i]
- with open(t, 'wb') as fp, open(s, 'rb') as infp:
- fp.write(bytearray('%s\\n','utf-8'))
- fp.write(infp.read())
+for t, s in zip(targets, sources):
+ with open(t, 'wb') as ofp, open(s, 'rb') as ifp:
+ ofp.write(bytearray('%s\\n', 'utf-8'))
+ ofp.write(ifp.read())
sys.exit(0)
"""