Skip to content

Commit

Permalink
test_smart_open: close gzip obj after writing (#822)
Browse files Browse the repository at this point in the history
fixes tests under python 3.12
  • Loading branch information
annaleeleaves authored May 8, 2024
1 parent b3d8621 commit 4acd4fc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 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,8 @@ 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)
with gzip.GzipFile(fileobj=buf, mode='w') as gz:
gz.write(data)
return buf.getvalue()


Expand Down

0 comments on commit 4acd4fc

Please sign in to comment.