summaryrefslogtreecommitdiff
path: root/test/timestamp-fallback.py
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2019-03-31 07:01:00 -0600
committerMats Wichmann <mats@linux.com>2019-04-25 09:37:04 -0600
commitf61d3bcd112285644c1a6ce253b267ef690a7e06 (patch)
tree2e489e238c11697f602cb9a7cbeb43afed088734 /test/timestamp-fallback.py
parentb0c3385604ebc1d7d552472f1cc6d0910aafa32a (diff)
downloadscons-git-f61d3bcd112285644c1a6ce253b267ef690a7e06.tar.gz
[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/timestamp-fallback.py')
-rw-r--r--test/timestamp-fallback.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/timestamp-fallback.py b/test/timestamp-fallback.py
index 6b1003352..f4e2e4d77 100644
--- a/test/timestamp-fallback.py
+++ b/test/timestamp-fallback.py
@@ -63,8 +63,11 @@ os.environ['PYTHONPATH'] = test.workpath('.')
test.write('SConstruct', """
DefaultEnvironment(tools=[])
+
def build(env, target, source):
- open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
+ with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp:
+ opf.write(ifp.read())
+
B = Builder(action = build)
env = Environment(tools = [], BUILDERS = { 'B' : B })
env.B(target = 'f1.out', source = 'f1.in')
@@ -90,10 +93,10 @@ build(["f4.out"], ["f4.in"])
"""),
stderr = None)
-os.utime(test.workpath('f1.in'),
+os.utime(test.workpath('f1.in'),
(os.path.getatime(test.workpath('f1.in')),
os.path.getmtime(test.workpath('f1.in'))+10))
-os.utime(test.workpath('f3.in'),
+os.utime(test.workpath('f3.in'),
(os.path.getatime(test.workpath('f3.in')),
os.path.getmtime(test.workpath('f3.in'))+10))