Skip to content

Commit

Permalink
test_smart_open: close gzip obj after writing
Browse files Browse the repository at this point in the history
fixes tests under python 3.12
  • Loading branch information
annalee committed May 8, 2024
1 parent b3d8621 commit 7442fc4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion smart_open/tests/test_smart_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,9 @@ def gzip_compress(data, filename=None):
buf = io.BytesIO()
buf.name = filename
with mock.patch('time.time', _MOCK_TIME):
gzip.GzipFile(fileobj=buf, mode='w').write(data)
gz = gzip.GzipFile(fileobj=buf, mode='w')
gz.write(data)
gz.close()
return buf.getvalue()


Expand Down

0 comments on commit 7442fc4

Please sign in to comment.