Skip to content

Commit 2cc9b42

Browse files
committed
tmp: test addimg missing zipfile close
1 parent c1c30dc commit 2cc9b42

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
matrix: ${{ steps.define.outputs.matrix }}
6363
full: ${{ steps.define.outputs.full }}
6464
env:
65-
PYTHON_VERSIONS: cp39 cp310 cp311 cp312 cp313 cp313t pp310 pp311
65+
PYTHON_VERSIONS: pp310 pp311
6666
FULL:
6767
${{ ( startsWith(github.ref, 'refs/tags') || startsWith(github.head_ref,
6868
'release-') || github.event_name == 'workflow_dispatch' ) && '1' || '0' }}
@@ -82,13 +82,6 @@ jobs:
8282
def add(name, platform, archs, build, qemu=False):
8383
CASES.append(locals())
8484
85-
86-
for identifier in ("manylinux", "musllinux"):
87-
build = " ".join(f"{py}-{identifier}_*" for py in PYTHON_VERSIONS if identifier=="manylinux" or py.startswith("cp"))
88-
add(f"Linux regular {identifier}", "ubuntu-latest", "x86_64 i686", build)
89-
if FULL:
90-
for arch in ("aarch64", "ppc64le", "s390x"):
91-
add(f"Linux {arch} {identifier}", "ubuntu-latest", arch, build, True)
9285
build = " ".join(f"{py}-*" for py in PYTHON_VERSIONS)
9386
add("Windows regular", "windows-latest", "AMD64 x86", build)
9487
if FULL:

tests/test/test_zipfile/test_core.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -312,26 +312,26 @@ def test_low_compression(self):
312312
self.assertEqual(openobj.read(1), b'2')
313313

314314
def test_writestr_compression(self):
315-
zipfp = zipfile.ZipFile(TESTFN2, "w")
316-
zipfp.writestr("b.txt", "hello world", compress_type=self.compression)
317-
info = zipfp.getinfo('b.txt')
318-
self.assertEqual(info.compress_type, self.compression)
315+
with zipfile.ZipFile(TESTFN2, "w") as zipfp:
316+
zipfp.writestr("b.txt", "hello world", compress_type=self.compression)
317+
info = zipfp.getinfo('b.txt')
318+
self.assertEqual(info.compress_type, self.compression)
319319

320320
def test_writestr_compresslevel(self):
321-
zipfp = zipfile.ZipFile(TESTFN2, "w", compresslevel=1)
322-
zipfp.writestr("a.txt", "hello world", compress_type=self.compression)
323-
zipfp.writestr("b.txt", "hello world", compress_type=self.compression,
324-
compresslevel=2)
321+
with zipfile.ZipFile(TESTFN2, "w", compresslevel=1) as zipfp:
322+
zipfp.writestr("a.txt", "hello world", compress_type=self.compression)
323+
zipfp.writestr("b.txt", "hello world", compress_type=self.compression,
324+
compresslevel=2)
325325

326-
# Compression level follows the constructor.
327-
a_info = zipfp.getinfo('a.txt')
328-
self.assertEqual(a_info.compress_type, self.compression)
329-
self.assertEqual(a_info.compress_level, 1)
326+
# Compression level follows the constructor.
327+
a_info = zipfp.getinfo('a.txt')
328+
self.assertEqual(a_info.compress_type, self.compression)
329+
self.assertEqual(a_info.compress_level, 1)
330330

331-
# Compression level is overridden.
332-
b_info = zipfp.getinfo('b.txt')
333-
self.assertEqual(b_info.compress_type, self.compression)
334-
self.assertEqual(b_info._compresslevel, 2)
331+
# Compression level is overridden.
332+
b_info = zipfp.getinfo('b.txt')
333+
self.assertEqual(b_info.compress_type, self.compression)
334+
self.assertEqual(b_info._compresslevel, 2)
335335

336336
def test_read_return_size(self):
337337
# Issue #9837: ZipExtFile.read() shouldn't return more bytes
@@ -2268,13 +2268,15 @@ def test_empty_zipfile(self):
22682268
zipf = zipfile.ZipFile(TESTFN, mode="r")
22692269
except zipfile.BadZipFile:
22702270
self.fail("Unable to create empty ZIP file in 'w' mode")
2271+
zipf.close()
22712272

22722273
zipf = zipfile.ZipFile(TESTFN, mode="a")
22732274
zipf.close()
22742275
try:
22752276
zipf = zipfile.ZipFile(TESTFN, mode="r")
22762277
except:
22772278
self.fail("Unable to create empty ZIP file in 'a' mode")
2279+
zipf.close()
22782280

22792281
def test_open_empty_file(self):
22802282
# Issue 1710703: Check that opening a file with less than 22 bytes

0 commit comments

Comments
 (0)