diff options
author | Mats Wichmann <mats@linux.com> | 2019-02-14 12:42:00 -0700 |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2019-02-14 15:13:16 -0700 |
commit | 887f4a1b06ceed33ee6ba4c5589a32a607d6b001 (patch) | |
tree | 48de09819749eea0e8d134386892397809122769 /test/NodeOps.py | |
parent | 334e11d04bb3be2f0ed93f929548e6cdc84c3158 (diff) | |
download | scons-git-887f4a1b06ceed33ee6ba4c5589a32a607d6b001.tar.gz |
Clean up some tests: use context managers
Plenty of complaints coming from Python 3.8alpha on unclosed files.
Targeted those areas which intersect with PyPy failures - this changeset
reduces the PyPy fails by 17 on the local test environment.
So this affects both Issue #3299 and the PyPy support project.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/NodeOps.py')
-rw-r--r-- | test/NodeOps.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/NodeOps.py b/test/NodeOps.py index 1f856c3e4..99a3f6ae7 100644 --- a/test/NodeOps.py +++ b/test/NodeOps.py @@ -122,7 +122,8 @@ import os Import('*') def mycopy(env, source, target): - open(str(target[0]),'w').write(open(str(source[0]),'r').read()) + with open(str(target[0]), 'wt') as fo, open(str(source[0]), 'rt') as fi: + fo.write(fi.read()) def exists_test(node): before = os.path.exists(str(node)) # doesn't exist yet in VariantDir |