diff options
author | William Deegan <bill@baddogconsulting.com> | 2019-04-28 19:43:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-28 19:43:43 (GMT) |
commit | 35e6bbe16a859b42efca4592b435695a530f0717 (patch) | |
tree | 5a298b113bb1899e91583866b41eb9c337c0857e /test/Repository/SConscript.py | |
parent | 44c7b81e1a47ff5d4439740b1e929ea723ee1f18 (diff) | |
parent | 4ecdcf07580b1bfcd03f7886b6ab9256ee825175 (diff) | |
download | SCons-35e6bbe16a859b42efca4592b435695a530f0717.zip SCons-35e6bbe16a859b42efca4592b435695a530f0717.tar.gz SCons-35e6bbe16a859b42efca4592b435695a530f0717.tar.bz2 |
Merge pull request #3345 from mwichmann/py38warns4-tests
[wip] Py38warns4 tests
Diffstat (limited to 'test/Repository/SConscript.py')
-rw-r--r-- | test/Repository/SConscript.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/test/Repository/SConscript.py b/test/Repository/SConscript.py index 1b67c07..1482800 100644 --- a/test/Repository/SConscript.py +++ b/test/Repository/SConscript.py @@ -61,10 +61,11 @@ SConscript('src/SConscript') test.write(['rep1', 'src', 'SConscript'], """\ def cat(env, source, target): target = str(target[0]) - f = open(target, "w") - for src in source: - f.write(open(str(src), "r").read()) - f.close() + with open(target, "w") as ofp: + for src in source: + with open(str(src), "r") as ifp: + ofp.write(ifp.read()) + env = Environment(BUILDERS={'Cat':Builder(action=cat)}) env.Cat(target = 'foo', source = ['aaa.in', 'bbb.in', 'ccc.in']) """) @@ -97,10 +98,11 @@ SConscript('src/SConscript') test.write(['rep2', 'src', 'SConscript'], """\ def cat(env, source, target): target = str(target[0]) - f = open(target, "wb") - for src in source: - f.write(open(str(src), "rb").read()) - f.close() + with open(target, "w") as ofp: + for src in source: + with open(str(src), "r") as ifp: + ofp.write(ifp.read()) + env = Environment(BUILDERS={'Cat':Builder(action=cat)}) env.Cat(target = 'foo', source = ['aaa.in', 'bbb.in', 'ccc.in']) SConscript('sub/SConscript') |