diff options
author | Mats Wichmann <mats@linux.com> | 2019-02-14 19:42:00 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2019-02-14 22:13:16 (GMT) |
commit | 887f4a1b06ceed33ee6ba4c5589a32a607d6b001 (patch) | |
tree | 48de09819749eea0e8d134386892397809122769 /test/MSVC | |
parent | 334e11d04bb3be2f0ed93f929548e6cdc84c3158 (diff) | |
download | SCons-887f4a1b06ceed33ee6ba4c5589a32a607d6b001.zip SCons-887f4a1b06ceed33ee6ba4c5589a32a607d6b001.tar.gz SCons-887f4a1b06ceed33ee6ba4c5589a32a607d6b001.tar.bz2 |
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/MSVC')
-rw-r--r-- | test/MSVC/generate-rc.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/MSVC/generate-rc.py b/test/MSVC/generate-rc.py index 00e9090..3dd4331 100644 --- a/test/MSVC/generate-rc.py +++ b/test/MSVC/generate-rc.py @@ -39,16 +39,16 @@ fake_rc = test.workpath('fake_rc.py') test.write(fake_rc, """\ import sys -contents = open(sys.argv[2], 'r').read() -open(sys.argv[1], 'w').write("fake_rc.py\\n" + contents) +with open(sys.argv[1], 'w') as fo, open(sys.argv[2], 'r') as fi: + fo.write("fake_rc.py\\n" + fi.read()) """) test.write('SConstruct', """ def generate_rc(target, source, env): t = str(target[0]) s = str(source[0]) - tfp = open(t, 'w') - tfp.write('generate_rc\\n' + open(s, 'r').read()) + with open(t, 'w') as fo, open(s, 'r') as fi: + fo.write('generate_rc\\n' + fi.read()) env = Environment(tools=['msvc'], RCCOM=r'%(_python_)s %(fake_rc)s $TARGET $SOURCE') |