summaryrefslogtreecommitdiffstats
path: root/test/option--random.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/option--random.py')
-rw-r--r--test/option--random.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/option--random.py b/test/option--random.py
index 357cf2e..2944ad8 100644
--- a/test/option--random.py
+++ b/test/option--random.py
@@ -38,10 +38,10 @@ test = TestSCons.TestSCons()
test.write('SConscript', """\
def cat(env, source, target):
target = str(target[0])
- f = open(target, "wb")
- for src in source:
- f.write(open(str(src), "rb").read())
- f.close()
+ with open(target, "wb") as f:
+ for src in source:
+ with open(str(src), "rb") as ifp:
+ f.write(ifp.read())
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'aaa.in')
env.Cat('bbb.out', 'bbb.in')