summaryrefslogtreecommitdiff
path: root/src/engine/SCons/BuilderTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/BuilderTests.py')
-rw-r--r--src/engine/SCons/BuilderTests.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py
index edc4ca8..255eced 100644
--- a/src/engine/SCons/BuilderTests.py
+++ b/src/engine/SCons/BuilderTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -22,7 +22,7 @@
#
from __future__ import print_function
-__revision__ = "src/engine/SCons/BuilderTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/BuilderTests.py 103260fce95bf5db1c35fb2371983087d85dd611 2019-07-13 18:25:30 bdbaddog"
import SCons.compat
@@ -680,7 +680,9 @@ class BuilderTestCase(unittest.TestCase):
def test_single_source(self):
"""Test Builder with single_source flag set"""
def func(target, source, env):
- open(str(target[0]), "w")
+ """create the file"""
+ with open(str(target[0]), "w"):
+ pass
if (len(source) == 1 and len(target) == 1):
env['CNT'][0] = env['CNT'][0] + 1
@@ -736,10 +738,12 @@ class BuilderTestCase(unittest.TestCase):
"""Testing handling lists of targets and source"""
def function2(target, source, env, tlist = [outfile, outfile2], **kw):
for t in target:
- open(str(t), 'w').write("function2\n")
+ with open(str(t), 'w') as f:
+ f.write("function2\n")
for t in tlist:
if not t in list(map(str, target)):
- open(t, 'w').write("function2\n")
+ with open(t, 'w') as f:
+ f.write("function2\n")
return 1
env = Environment()
@@ -765,10 +769,12 @@ class BuilderTestCase(unittest.TestCase):
def function3(target, source, env, tlist = [sub1_out, sub2_out]):
for t in target:
- open(str(t), 'w').write("function3\n")
+ with open(str(t), 'w') as f:
+ f.write("function3\n")
for t in tlist:
if not t in list(map(str, target)):
- open(t, 'w').write("function3\n")
+ with open(t, 'w') as f:
+ f.write("function3\n")
return 1
builder = SCons.Builder.Builder(action = function3)