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

support python 3.11 #376

Merged
merged 5 commits into from
Sep 11, 2022
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11-dev']

steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down
15 changes: 13 additions & 2 deletions artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ def __iter__(self):
return self.iterator


class _ArtifactoryAccessor(pathlib._Accessor):
class _ArtifactoryAccessor:

"""
Implements operations with Artifactory REST API
"""
Expand Down Expand Up @@ -998,7 +999,7 @@ def unlink(self, pathobj):
"""

if not pathobj.exists():
raise OSError(2, f"No such file or directory: {pathobj}")
raise FileNotFoundError(2, f"No such file or directory: {pathobj}")

url = "/".join(
[
Expand Down Expand Up @@ -1897,6 +1898,16 @@ def lchmod(self, mode):
"""
raise NotImplementedError()

def unlink(self, missing_ok=False):
beliaev-maksim marked this conversation as resolved.
Show resolved Hide resolved
"""
Removes a file or folder
"""
try:
self._accessor.unlink(self)
except FileNotFoundError:
if not missing_ok:
allburov marked this conversation as resolved.
Show resolved Hide resolved
raise

def symlink_to(self, target, target_is_directory=False):
"""
Throw NotImplementedError
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Filesystems",
],
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_artifactory_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def test_unlink_raises_not_found(self):
status=404,
body="Unable to find item",
)
with self.assertRaises(OSError) as context:
with self.assertRaises(FileNotFoundError) as context:
path.unlink()

self.assertTrue("No such file or directory" in context.exception.strerror)
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ envlist =
py38
py39
py310
py311
pre-commit

[testenv]
Expand Down