summaryrefslogtreecommitdiffstats
path: root/test/SConscript
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2019-03-31 13:01:00 (GMT)
committerMats Wichmann <mats@linux.com>2019-04-25 15:37:04 (GMT)
commitf61d3bcd112285644c1a6ce253b267ef690a7e06 (patch)
tree2e489e238c11697f602cb9a7cbeb43afed088734 /test/SConscript
parentb0c3385604ebc1d7d552472f1cc6d0910aafa32a (diff)
downloadSCons-f61d3bcd112285644c1a6ce253b267ef690a7e06.zip
SCons-f61d3bcd112285644c1a6ce253b267ef690a7e06.tar.gz
SCons-f61d3bcd112285644c1a6ce253b267ef690a7e06.tar.bz2
[PY 3.8] test fixes for file closings, rawstrings
On a linux host (missing some things that may be on the Travis CI setup), Py3.8a3 now shows 19 fails, 1048 pass, with 84 Warning: messages. Signed-off-by: Mats Wichmann <mats@linux.com>
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)