File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change 18
18
from twine .commands import upload
19
19
from twine import package , cli , exceptions
20
20
import twine
21
+ from twine .utils import DEFAULT_REPOSITORY , TEST_REPOSITORY
21
22
22
23
import helpers
23
24
27
28
NEW_SDIST_FIXTURE = 'tests/fixtures/twine-1.6.5.tar.gz'
28
29
NEW_WHEEL_FIXTURE = 'tests/fixtures/twine-1.6.5-py2.py3-none-any.whl'
29
30
NEW_RELEASE_URL = 'https://pypi.org/project/twine/1.6.5/'
30
- DEFAULT_REPOSITORY = "https://upload.pypi.org/legacy/"
31
- TEST_REPOSITORY = "https://test.pypi.org/legacy/"
32
31
33
32
34
33
def test_successful_upload (make_settings , capsys ):
@@ -289,10 +288,10 @@ def none_upload(*args, **settings_kwargs):
289
288
assert "/foo/bar.crt" == upload_settings .cacert
290
289
291
290
292
- def test_check_status_code (make_settings , capsys ):
291
+ def test_check_status_code_for_wrong_repo_url (make_settings , capsys ):
293
292
upload_settings = make_settings ()
294
293
295
- # override default upload_settings
294
+ # override defaults to use incorrect URL
296
295
upload_settings .repository_config ['repository' ] = \
297
296
"https://upload.pypi.org"
298
297
Original file line number Diff line number Diff line change 18
18
from twine .package import PackageFile
19
19
from twine import exceptions
20
20
from twine import settings
21
+ from twine .utils import DEFAULT_REPOSITORY , TEST_REPOSITORY
21
22
22
23
from requests .exceptions import HTTPError
23
24
24
25
25
- DEFAULT_REPOSITORY = "https://upload.pypi.org/legacy/"
26
- TEST_REPOSITORY = "https://test.pypi.org/legacy/"
27
-
28
-
29
26
def skip_upload (response , skip_existing , package ):
30
27
filename = package .basefilename
31
28
msg_400 = (
@@ -67,8 +64,8 @@ def check_status_code(response, verbose):
67
64
"testpypi.python.org). You've received a 410 error response. "
68
65
"Uploading to those sites is deprecated. The new sites are "
69
66
"pypi.org and test.pypi.org. Try using "
70
- "https://upload.pypi.org/legacy/ "
71
- "(or https://test.pypi.org/legacy/ ) to upload your packages "
67
+ f" { DEFAULT_REPOSITORY } "
68
+ f "(or { TEST_REPOSITORY } ) to upload your packages "
72
69
"instead. These are the default URLs for Twine now. More at "
73
70
"https://packaging.python.org/guides/migrating-to-pypi-org/ " )
74
71
elif response .status_code == 405 and "pypi.org" in response .url :
You can’t perform that action at this time.
0 commit comments