summaryrefslogtreecommitdiffstats
path: root/test/Delete.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/Delete.py')
-rw-r--r--test/Delete.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/Delete.py b/test/Delete.py
index 94ba24a..fc4ab4f 100644
--- a/test/Delete.py
+++ b/test/Delete.py
@@ -44,10 +44,10 @@ Execute(Delete('symlinks/dirlink'))
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 ofp:
+ for src in source:
+ with open(str(src), "rb") as ifp:
+ ofp.write(ifp.read())
Cat = Action(cat)
env = Environment()
env.Command('f3.out', 'f3.in', [Cat, Delete("f4"), Delete("d5")])
@@ -194,10 +194,10 @@ if sys.platform != 'win32':
test.write("SConstruct", """\
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 ifp:
+ for src in source:
+ with open(str(src), "rb") as ofp:
+ ofp.write(ifp.read())
Cat = Action(cat)
env = Environment()
env.Command('f14-nonexistent.out', 'f14.in', [Delete("$TARGET", must_exist=1),