summaryrefslogtreecommitdiffstats
path: root/test/SConscript
diff options
context:
space:
mode:
Diffstat (limited to 'test/SConscript')
-rw-r--r--test/SConscript/SConscript.py2
-rw-r--r--test/SConscript/SConscriptChdir.py24
2 files changed, 18 insertions, 8 deletions
diff --git a/test/SConscript/SConscript.py b/test/SConscript/SConscript.py
index 36288be..fd8511d 100644
--- a/test/SConscript/SConscript.py
+++ b/test/SConscript/SConscript.py
@@ -74,7 +74,7 @@ SConscript('SConscript5')
try:
from collections import UserList
except ImportError:
- exec('from UserList import UserList')
+ from UserList import UserList
x7 = "SConstruct x7"
x8 = "SConstruct x8"
x9 = SConscript('SConscript6', UserList(["x7", "x8"]))
diff --git a/test/SConscript/SConscriptChdir.py b/test/SConscript/SConscriptChdir.py
index 6cd4566..5468a54 100644
--- a/test/SConscript/SConscriptChdir.py
+++ b/test/SConscript/SConscriptChdir.py
@@ -44,33 +44,43 @@ SConscript('dir5/SConscript')
""")
test.write(['dir1', 'SConscript'], """
-exec(open("create_test.py", 'r').read())
+with open("create_test.py", 'r') as f:
+ contents = f.read()
+exec(contents)
""")
test.write(['dir2', 'SConscript'], """
-exec(open("create_test.py", 'r').read())
+with open("create_test.py", 'r') as f:
+ contents = f.read()
+exec(contents)
""")
test.write(['dir3', 'SConscript'], """
import os.path
name = os.path.join('dir3', 'create_test.py')
-exec(open(name, 'r').read())
+with open(name, 'r') as f:
+ contents = f.read()
+exec(contents)
""")
test.write(['dir4', 'SConscript'], """
-exec(open("create_test.py", 'r').read())
+with open("create_test.py", 'r') as f:
+ contents = f.read()
+exec(contents)
""")
test.write(['dir5', 'SConscript'], """
import os.path
name = os.path.join('dir5', 'create_test.py')
-exec(open(name, 'r').read())
+with open(name, 'r') as f:
+ contents = f.read()
+exec(contents)
""")
for dir in ['dir1', 'dir2', 'dir3','dir4', 'dir5']:
test.write([dir, 'create_test.py'], r"""
-f = open("test.txt", "a")
-f.write("This is the %s test.\n")
+with open("test.txt", "a") as f:
+ f.write("This is the %s test.\n")
f.close()
""" % dir)