diff options
author | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2024-05-18 13:36:57 (GMT) |
---|---|---|
committer | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2024-05-18 13:36:57 (GMT) |
commit | d0ced8a759f1c9090edca3e7ba9885ed5894f9e9 (patch) | |
tree | 3750a7e135ae445b63d852883e071c833d9c0583 /testing | |
parent | c62477304527d178bc47cfbf5b642eded471b1cb (diff) | |
parent | c33bb1a8a7db16f6fc0a2cf950b75a1c48d1e424 (diff) | |
download | SCons-d0ced8a759f1c9090edca3e7ba9885ed5894f9e9.zip SCons-d0ced8a759f1c9090edca3e7ba9885ed5894f9e9.tar.gz SCons-d0ced8a759f1c9090edca3e7ba9885ed5894f9e9.tar.bz2 |
Merge branch 'master' into jbrill-msvc-detect
Diffstat (limited to 'testing')
-rw-r--r-- | testing/framework/TestSCons_time.py | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/testing/framework/TestSCons_time.py b/testing/framework/TestSCons_time.py index b84bff2..d2f061a 100644 --- a/testing/framework/TestSCons_time.py +++ b/testing/framework/TestSCons_time.py @@ -103,7 +103,7 @@ Memory after reading SConscript files: 200%(index)s Memory before building targets: 300%(index)s Memory after building targets: 400%(index)s Object counts: - pre- post- pre- post- + pre- post- pre- post- read read build build Class 101%(index)s 102%(index)s 103%(index)s 104%(index)s Action.CommandAction 201%(index)s 202%(index)s 203%(index)s 204%(index)s Action.CommandGeneratorAction @@ -273,20 +273,16 @@ class TestSCons_time(TestCommon): def write_sample_tarfile(self, archive, dir, files): import shutil - try: - import tarfile - except ImportError: - self.skip_test('no tarfile module\n', from_framework=True) - else: - base, suffix = self.archive_split(archive) + import tarfile + base, suffix = self.archive_split(archive) - mode = { - '.tar' : 'w', - '.tar.gz' : 'w:gz', - '.tgz' : 'w:gz', - } + mode = { + '.tar' : 'w', + '.tar.gz' : 'w:gz', + '.tgz' : 'w:gz', + } - tar = tarfile.open(archive, mode[suffix]) + with tarfile.open(archive, mode[suffix]) as tar: for name, content in files: path = os.path.join(dir, name) with open(path, 'wb') as f: @@ -298,30 +294,20 @@ class TestSCons_time(TestCommon): tarinfo.gname = 'fake_group' with open(path, 'rb') as f: tar.addfile(tarinfo, f) - tar.close() - shutil.rmtree(dir) - return self.workpath(archive) + shutil.rmtree(dir) + return self.workpath(archive) def write_sample_zipfile(self, archive, dir, files): import shutil - try: - import zipfile - except ImportError: - - sys.stderr.write('no zipfile module\n') - self.no_result() - - else: - - zip = zipfile.ZipFile(archive, 'w') + import zipfile + with zipfile.ZipFile(archive, 'w') as zip: for name, content in files: path = os.path.join(dir, name) with open(path, 'w') as f: f.write(content) zip.write(path) - zip.close() - shutil.rmtree(dir) - return self.workpath(archive) + shutil.rmtree(dir) + return self.workpath(archive) sample_project_files = [ ('SConstruct', SConstruct), |