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

Nexus repo fix #694

Merged
merged 5 commits into from Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -29,3 +29,4 @@ Peter Stensmyr <peter.stensmyr@gmail.com> (http://www.peterstensmyr.com)
Felipe Mulinari Rocha Campos <felipecampos@google.com>
Devesh Kumar Singh <deveshkusingh@gmail.com>
Yesha Maggi <yesha.maggic@gmail.com>
Cyril de Catheu <cdecatheu@gmail.com> (https://catheu.tech/)
45 changes: 45 additions & 0 deletions tests/test_upload.py
Expand Up @@ -335,6 +335,51 @@ def test_prints_skip_message_for_response(
),
id="nexus",
),
pytest.param(
dict(
status_code=400,
text=(
'<!DOCTYPE html>\n<html lang="en">\n<head>\n'
" <title>400 - Nexus Repository Manager</title>\n"
' <meta http-equiv="Content-Type" '
'content="text/html; charset=UTF-8"/>\n\n\n'
" <!--[if lt IE 9]>\n <script>(new Image).src="
'"https://nexus.server.io/favicon.ico?3.25.1-04"</script>\n'
' <![endif]-->\n <link rel="icon" type="image/png" href='
'"https://nexus.server.io/favicon-32x32.png?3.25.1-04" '
'sizes="32x32">\n <link rel="mask-icon" href='
'"https://nexus.server.io/safari-pinned-tab.svg?3.25.1-04"'
' color="#5bbad5">\n <link rel="icon" type="image/png"'
' href="https://nexus.server.io/favicon-16x16.png?3.25.1-04"'
' sizes="16x16">\n <link rel="shortcut icon" href'
'="https://nexus.server.io/favicon.ico?3.25.1-04">\n'
' <meta name="msapplication-TileImage" '
'content="https://nexus.server.io/mstile-144x144.png?3.25.1-04">\n'
' <meta name="msapplication-TileColor" content="#00a300">\n\n'
' <link rel="stylesheet" type="text/css" href='
'"https://nexus.server.io/static/css/nexus-content.css?3.25.1-04"/>'
"\n</head>\n<body>\n"
'<div class="nexus-header">\n <a href="https://nexus.server.io">\n'
' <div class="product-logo">\n <img src='
'"https://nexus.server.io/static/images/nexus.png?3.25.1-04"'
' alt="Product logo"/>\n </div>\n <div class='
'"product-id">\n <div class="product-id__line-1">\n'
' <span class="product-name">Nexus Repository Manager</span>'
'\n </div>\n <div class="product-id__line-2">\n'
' <span class="product-spec">OSS 3.25.1-04</span>\n'
" </div>\n </div>\n </a>\n</div>\n\n<div class="
'"nexus-body">\n <div class="content-header">\n <img src='
'"https://nexus.server.io/static/rapture/resources/icons/x32/'
'exclamation.png?3.25.1-04" alt="Exclamation point" aria-role='
'"presentation"/>\n <span class="title">Error 400</span>\n'
' <span class="description">Bad Request</span>\n </div>\n'
' <div class="content-body">\n <div class="content-section">\n'
" Repository does not allow updating assets: pypi-local\n"
" </div>\n </div>\n</div>\n</body>\n</html>"
),
cyrilou242 marked this conversation as resolved.
Show resolved Hide resolved
),
id="nexus_new",
),
pytest.param(
dict(
status_code=409,
Expand Down
2 changes: 1 addition & 1 deletion twine/commands/upload.py
Expand Up @@ -46,7 +46,7 @@ def skip_upload(
# PyPI / TestPyPI
or (status == 400 and "already exist" in reason)
# Nexus Repository OSS (https://www.sonatype.com/nexus-repository-oss)
or (status == 400 and "updating asset" in reason)
or (status == 400 and ("updating asset" in reason or "updating asset" in text))
cyrilou242 marked this conversation as resolved.
Show resolved Hide resolved
# Artifactory (https://jfrog.com/artifactory/)
or (status == 403 and "overwrite artifact" in text)
)
Expand Down