Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
0b33b87b
Commit
0b33b87b
authored
Oct 15, 2018
by
pauleikis
Committed by
Sébastien Eustace
Oct 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise ValueError when repository does not contain any valid package with required version (#421)
parent
f319b55c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
0 deletions
+27
-0
poetry/repositories/legacy_repository.py
+6
-0
tests/repositories/fixtures/legacy/missing-version.html
+12
-0
tests/repositories/test_legacy_repository.py
+9
-0
No files found.
poetry/repositories/legacy_repository.py
View file @
0b33b87b
...
@@ -298,6 +298,12 @@ class LegacyRepository(PyPiRepository):
...
@@ -298,6 +298,12 @@ class LegacyRepository(PyPiRepository):
}
}
links
=
list
(
page
.
links_for_version
(
Version
.
parse
(
version
)))
links
=
list
(
page
.
links_for_version
(
Version
.
parse
(
version
)))
if
not
links
:
raise
ValueError
(
'No valid distribution links found for package: "{}" version: "{}"'
.
format
(
name
,
version
)
)
urls
=
{}
urls
=
{}
hashes
=
[]
hashes
=
[]
default_link
=
links
[
0
]
default_link
=
links
[
0
]
...
...
tests/repositories/fixtures/legacy/missing-version.html
0 → 100644
View file @
0b33b87b
<!DOCTYPE html>
<html>
<head>
<title>
Links for poetry
</title>
</head>
<body>
<h1>
Links for poetry
</h1>
<a
href=
"poetry-0.1.0-py3-none-any.whl#sha256=1d85132efab8ead3c6f69202843da40a03823992091c29f8d65a31af68940163"
data-requires-python=
">=3.6.0"
>
poetry-0.1.0-py3-none-any.whl
</a><br/>
</body>
</html>
<!--SERIAL 3907384-->
\ No newline at end of file
tests/repositories/test_legacy_repository.py
View file @
0b33b87b
import
pytest
from
poetry.repositories.legacy_repository
import
LegacyRepository
from
poetry.repositories.legacy_repository
import
LegacyRepository
from
poetry.repositories.legacy_repository
import
Page
from
poetry.repositories.legacy_repository
import
Page
from
poetry.utils._compat
import
Path
from
poetry.utils._compat
import
Path
...
@@ -50,3 +52,10 @@ def test_http_basic_auth_repo(mocker):
...
@@ -50,3 +52,10 @@ def test_http_basic_auth_repo(mocker):
mock
.
assert_called_once_with
(
"legacy"
)
mock
.
assert_called_once_with
(
"legacy"
)
assert
repo
.
_session
.
auth
==
(
"user1"
,
"p4ss"
)
assert
repo
.
_session
.
auth
==
(
"user1"
,
"p4ss"
)
def
test_missing_version
(
mocker
):
repo
=
MockRepository
()
with
pytest
.
raises
(
ValueError
):
repo
.
_get_release_info
(
"missing_version"
,
"1.1.0"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment