GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Properly close files in test_zipfile · elide-dev/graalpython@2ab21b8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • graalpython/lib-python/3/test
    • test_zipfile.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎graalpython/lib-python/3/test/test_zipfile.py‎

Copy file name to clipboardExpand all lines: graalpython/lib-python/3/test/test_zipfile.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ def test_writestr_compression(self):
307307
zipfp.writestr("b.txt", "hello world", compress_type=self.compression)
308308
info = zipfp.getinfo('b.txt')
309309
self.assertEqual(info.compress_type, self.compression)
310+
# GraalPy change
311+
zipfp.close()
310312

311313
def test_writestr_compresslevel(self):
312314
zipfp = zipfile.ZipFile(TESTFN2, "w", compresslevel=1)
@@ -323,6 +325,8 @@ def test_writestr_compresslevel(self):
323325
b_info = zipfp.getinfo('b.txt')
324326
self.assertEqual(b_info.compress_type, self.compression)
325327
self.assertEqual(b_info._compresslevel, 2)
328+
# GraalPy change
329+
zipfp.close()
326330

327331
def test_read_return_size(self):
328332
# Issue #9837: ZipExtFile.read() shouldn't return more bytes
@@ -2075,13 +2079,17 @@ def test_empty_zipfile(self):
20752079
zipf.close()
20762080
try:
20772081
zipf = zipfile.ZipFile(TESTFN, mode="r")
2082+
# GraalPy change
2083+
zipf.close()
20782084
except zipfile.BadZipFile:
20792085
self.fail("Unable to create empty ZIP file in 'w' mode")
20802086

20812087
zipf = zipfile.ZipFile(TESTFN, mode="a")
20822088
zipf.close()
20832089
try:
20842090
zipf = zipfile.ZipFile(TESTFN, mode="r")
2091+
# GraalPy change
2092+
zipf.close()
20852093
except:
20862094
self.fail("Unable to create empty ZIP file in 'a' mode")
20872095

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.