Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix zstd compression in ab mode #833

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions smart_open/tests/test_smart_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,22 @@ def test_atplus(self):
self.assertEqual(text, SAMPLE_TEXT * 2)


class CompressionRealFileSystemTests(RealFileSystemTests):
"""Same as RealFileSystemTests but with a compressed file."""

def setUp(self):
with named_temporary_file(prefix='test', suffix='.zst', delete=False) as fout:
self.temp_file = fout.name
with smart_open.open(self.temp_file, 'wb') as fout:
fout.write(SAMPLE_BYTES)

def test_aplus(self):
pass # transparent (de)compression unsupported for mode 'ab+'

def test_atplus(self):
pass # transparent (de)compression unsupported for mode 'ab+'


#
# What exactly to patch here differs on _how_ we're opening the file.
# See the _shortcut_open function for details.
Expand Down
2 changes: 2 additions & 0 deletions smart_open/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ def __exit__(self, exc_type, exc_val, exc_tb):


class FileLikeProxy(wrapt.ObjectProxy):
__inner = ... # initialized before wrapt disallows __setattr__ on certain objects

def __init__(self, outer, inner):
super().__init__(outer)
self.__inner = inner
Expand Down
Loading