Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
liormizr committed Nov 9, 2024
1 parent 719a453 commit a2cdbb8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
6 changes: 5 additions & 1 deletion s3path/current_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PureS3Path(PurePath):
S3 is not a file-system but we can look at it like a POSIX system.
"""
_flavour = posixpath
_flavour = posixpath # not relevant after Python version 3.13
parser = posixpath
__slots__ = ()

Expand All @@ -62,6 +62,10 @@ def __init__(self, *args):
new_parts.remove(part)

self._raw_paths = new_parts
if sys.version_info >= (3, 13):
self._drv, self._root, self._tail_cached = self._parse_path(self._raw_path)
else:
self._load_parts()

@classmethod
def from_uri(cls, uri: str):
Expand Down
17 changes: 14 additions & 3 deletions tests/test_path_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ def test_glob_nested_folders_issue_no_120(s3_mock):


def test_glob_old_algo(s3_mock, enable_old_glob):
with pytest.deprecated_call():
if sys.version_info > (3, 12):
with pytest.deprecated_call():
test_glob(s3_mock)
else:
test_glob(s3_mock)


Expand Down Expand Up @@ -271,7 +274,11 @@ def test_rglob(s3_mock):


def test_rglob_old_algo(s3_mock, enable_old_glob):
test_rglob(s3_mock)
if sys.version_info > (3, 12):
with pytest.deprecated_call():
test_rglob(s3_mock)
else:
test_rglob(s3_mock)


def test_accessor_scandir(s3_mock):
Expand Down Expand Up @@ -299,7 +306,10 @@ def test_accessor_scandir(s3_mock):


def test_accessor_scandir_old_algo(s3_mock, enable_old_glob):
with pytest.deprecated_call():
if sys.version_info > (3, 12):
with pytest.deprecated_call():
test_accessor_scandir(s3_mock)
else:
test_accessor_scandir(s3_mock)


Expand Down Expand Up @@ -828,6 +838,7 @@ def test_unlink(s3_mock):
S3Path("/test-bucket/fake_folder").unlink(missing_ok=True)
S3Path("/fake-bucket/").unlink(missing_ok=True)


def test_absolute(s3_mock):
s3 = boto3.resource('s3')
s3.create_bucket(Bucket='test-bucket')
Expand Down

0 comments on commit a2cdbb8

Please sign in to comment.