Skip to content

Commit

Permalink
feat: skip upload for sonatype nexus collision
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacques Fournier committed Jan 24, 2025
1 parent aa3a910 commit 4df1dc8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,16 @@ def test_prints_skip_message_for_response(
),
id="gitlab_enterprise",
),
pytest.param(
dict(
status_code=400,
text=(
"pypi-local:twine/1.5.0/twine-1.5.0-py2.py3-none-any.whl"
" cannot be updated"
),
),
id="sonatype_nexus",
),
],
)
def test_skip_existing_skips_files_on_repository(response_kwargs):
Expand Down
3 changes: 3 additions & 0 deletions twine/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def skip_upload(
or (status == 403 and "overwrite artifact" in text)
# Gitlab Enterprise Edition (https://about.gitlab.com)
or (status == 400 and "already been taken" in text)
# Sonatype Nexus Repository
# (https://help.sonatype.com/en/pypi-repositories.html)
or (status == 400 and "cannot be updated" in text)
)


Expand Down

0 comments on commit 4df1dc8

Please sign in to comment.