summaryrefslogtreecommitdiffstats
path: root/test/Requires
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/Requires
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/Requires')
-rw-r--r--test/Requires/basic.py11
-rw-r--r--test/Requires/eval-order.py7
2 files changed, 9 insertions, 9 deletions
diff --git a/test/Requires/basic.py b/test/Requires/basic.py
index edce13b..4851ac8 100644
--- a/test/Requires/basic.py
+++ b/test/Requires/basic.py
@@ -35,11 +35,12 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """
def append_prereq_func(target, source, env):
- fp = open(str(target[0]), 'wb')
- for s in source:
- fp.write(open(str(s), 'rb').read())
- fp.write(open('prereq.out', 'rb').read())
- fp.close()
+ with open(str(target[0]), 'wb') as ofp:
+ for s in source:
+ with open(str(s), 'rb') as ifp:
+ ofp.write(ifp.read())
+ with open('prereq.out', 'rb') as ifp:
+ ofp.write(ifp.read())
return None
append_prereq = Action(append_prereq_func)
env = Environment()
diff --git a/test/Requires/eval-order.py b/test/Requires/eval-order.py
index 77fbc98..fddf232 100644
--- a/test/Requires/eval-order.py
+++ b/test/Requires/eval-order.py
@@ -34,11 +34,10 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """
def copy_and_create_func(target, source, env):
- with open(str(target[0]), 'w') as fp:
+ with open(str(target[0]), 'w') as ofp:
for s in source:
- with open(str(s), 'r') as f:
- fp.write(f.read())
- open('file.in', 'w').write("file.in 1\\n")
+ with open(str(s), 'r') as ifp:
+ ofp.write(ifp.read())
with open('file.in', 'w') as f:
f.write("file.in 1\\n")
return None