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
277fa607
Unverified
Commit
277fa607
authored
May 19, 2023
by
Riccardo Albertazzi
Committed by
GitHub
May 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add test for url with trailing slash (#7952)
parent
3602b217
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
tests/repositories/test_legacy_repository.py
+10
-2
No files found.
tests/repositories/test_legacy_repository.py
View file @
277fa607
...
@@ -3,7 +3,6 @@ from __future__ import annotations
...
@@ -3,7 +3,6 @@ from __future__ import annotations
import
base64
import
base64
import
re
import
re
import
shutil
import
shutil
import
urllib.parse
as
urlparse
from
pathlib
import
Path
from
pathlib
import
Path
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
...
@@ -14,6 +13,7 @@ import requests
...
@@ -14,6 +13,7 @@ import requests
from
packaging.utils
import
canonicalize_name
from
packaging.utils
import
canonicalize_name
from
poetry.core.constraints.version
import
Version
from
poetry.core.constraints.version
import
Version
from
poetry.core.packages.dependency
import
Dependency
from
poetry.core.packages.dependency
import
Dependency
from
poetry.core.packages.utils.link
import
Link
from
poetry.factory
import
Factory
from
poetry.factory
import
Factory
from
poetry.repositories.exceptions
import
PackageNotFound
from
poetry.repositories.exceptions
import
PackageNotFound
...
@@ -51,7 +51,7 @@ class MockRepository(LegacyRepository):
...
@@ -51,7 +51,7 @@ class MockRepository(LegacyRepository):
return
SimpleRepositoryPage
(
self
.
_url
+
f
"/{name}/"
,
f
.
read
())
return
SimpleRepositoryPage
(
self
.
_url
+
f
"/{name}/"
,
f
.
read
())
def
_download
(
self
,
url
:
str
,
dest
:
Path
)
->
None
:
def
_download
(
self
,
url
:
str
,
dest
:
Path
)
->
None
:
filename
=
urlparse
.
urlparse
(
url
)
.
path
.
rsplit
(
"/"
)[
-
1
]
filename
=
Link
(
url
)
.
filename
filepath
=
self
.
FIXTURES
.
parent
/
"pypi.org"
/
"dists"
/
filename
filepath
=
self
.
FIXTURES
.
parent
/
"pypi.org"
/
"dists"
/
filename
shutil
.
copyfile
(
str
(
filepath
),
dest
)
shutil
.
copyfile
(
str
(
filepath
),
dest
)
...
@@ -462,6 +462,14 @@ def test_find_links_for_package_yanked(
...
@@ -462,6 +462,14 @@ def test_find_links_for_package_yanked(
assert
link
.
yanked_reason
==
yanked_reason
assert
link
.
yanked_reason
==
yanked_reason
def
test_cached_or_downloaded_file_supports_trailing_slash
()
->
None
:
repo
=
MockRepository
()
with
repo
.
_cached_or_downloaded_file
(
Link
(
"https://foo.bar/pytest-3.5.0-py2.py3-none-any.whl/"
)
)
as
filepath
:
assert
filepath
.
name
==
"pytest-3.5.0-py2.py3-none-any.whl"
class
MockHttpRepository
(
LegacyRepository
):
class
MockHttpRepository
(
LegacyRepository
):
def
__init__
(
def
__init__
(
self
,
endpoint_responses
:
dict
[
str
,
int
],
http
:
type
[
httpretty
.
httpretty
]
self
,
endpoint_responses
:
dict
[
str
,
int
],
http
:
type
[
httpretty
.
httpretty
]
...
...
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