Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelange committed Dec 15, 2024
1 parent 1266ddb commit d3be215
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- {python-version: '3.10', os: windows-2019}
- {python-version: '3.11', os: windows-2019}
- {python-version: '3.12', os: windows-2019}
- {python-version: '3.13', os: windows-2019}
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -78,6 +79,9 @@ jobs:
# - {python-version: '3.8', os: windows-2019}
# - {python-version: '3.9', os: windows-2019}
# - {python-version: '3.10', os: windows-2019}
# - {python-version: '3.11', os: windows-2019}
# - {python-version: '3.12', os: windows-2019}
# - {python-version: '3.13', os: windows-2019}

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -114,6 +118,9 @@ jobs:
# - {python-version: '3.8', os: windows-2019}
# - {python-version: '3.9', os: windows-2019}
# - {python-version: '3.10', os: windows-2019}
# - {python-version: '3.11', os: windows-2019}
# - {python-version: '3.12', os: windows-2019}
# - {python-version: '3.13', os: windows-2019}

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -162,6 +169,9 @@ jobs:
# - {python-version: '3.8', os: windows-2019}
# - {python-version: '3.9', os: windows-2019}
# - {python-version: '3.10', os: windows-2019}
# - {python-version: '3.11', os: windows-2019}
# - {python-version: '3.12', os: windows-2019}
# - {python-version: '3.13', os: windows-2019}

steps:
- uses: actions/checkout@v2
Expand Down
11 changes: 5 additions & 6 deletions smart_open/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,19 +394,17 @@ def __init__(
):
self._is_closed = False
self._container_name = container

self._blob = _get_blob_client(client, container, blob)
self._blob_kwargs = blob_kwargs or {}
# type: azure.storage.blob.BlobClient

self._min_part_size = min_part_size

self._total_size = 0
self._total_parts = 0
self._bytes_uploaded = 0
self._current_part = io.BytesIO()
self._block_list = []

# type: azure.storage.blob.BlobClient
self._blob = _get_blob_client(client, container, blob)

#
# This member is part of the io.BufferedIOBase interface.
#
Expand Down Expand Up @@ -535,6 +533,7 @@ def __repr__(self):
return "%s(container=%r, blob=%r, min_part_size=%r)" % (
self.__class__.__name__,
self._container_name,
self._blob.blob_name,
# python 3.13 calls __repr__ during error handling of exception in __init__
self._blob.blob_name if hasattr(self, "_blob") else "failed_init",
self._min_part_size
)
13 changes: 13 additions & 0 deletions smart_open/hdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,18 @@ def __init__(self, uri):
#
self.raw = None

@property
def closed(self):
return self._sub is None

#
# Override some methods from io.IOBase.
#
def close(self):
"""Flush and close this stream."""
logger.debug("close: called")
if self.closed:
return
self._sub.terminate()
self._sub = None

Expand Down Expand Up @@ -135,10 +141,17 @@ def __init__(self, uri):
#
self.raw = None

@property
def closed(self):
return self._sub is None

def close(self):
if self.closed:
return
self.flush()
self._sub.stdin.close()
self._sub.wait()
self._sub = None

def flush(self):
self._sub.stdin.flush()
Expand Down

0 comments on commit d3be215

Please sign in to comment.