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
6a927b5c
Unverified
Commit
6a927b5c
authored
Jun 26, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise an error when dependency name != package name
parent
12913a11
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
0 deletions
+51
-0
poetry/puzzle/provider.py
+8
-0
tests/puzzle/conftest.py
+36
-0
tests/puzzle/test_solver.py
+7
-0
No files found.
poetry/puzzle/provider.py
View file @
6a927b5c
...
@@ -225,6 +225,14 @@ class Provider:
...
@@ -225,6 +225,14 @@ class Provider:
finally
:
finally
:
shutil
.
rmtree
(
tmp_dir
.
as_posix
())
shutil
.
rmtree
(
tmp_dir
.
as_posix
())
if
dependency
.
name
!=
package
.
name
:
# For now, the dependency's name must match the actual package's name
raise
RuntimeError
(
"The dependency name for {} does not match the actual package's name: {}"
.
format
(
dependency
.
name
,
package
.
name
)
)
return
[
package
]
return
[
package
]
def
search_for_file
(
self
,
dependency
):
# type: (FileDependency) -> List[Package]
def
search_for_file
(
self
,
dependency
):
# type: (FileDependency) -> List[Package]
...
...
tests/puzzle/conftest.py
0 → 100644
View file @
6a927b5c
import
pytest
import
shutil
try
:
import
urllib.parse
as
urlparse
except
ImportError
:
import
urlparse
from
poetry.utils._compat
import
Path
def
mock_clone
(
self
,
source
,
dest
):
# Checking source to determine which folder we need to copy
parts
=
urlparse
.
urlparse
(
source
)
folder
=
(
Path
(
__file__
)
.
parent
.
parent
/
"fixtures"
/
"git"
/
parts
.
netloc
/
parts
.
path
.
lstrip
(
"/"
)
.
rstrip
(
".git"
)
)
shutil
.
rmtree
(
str
(
dest
))
shutil
.
copytree
(
str
(
folder
),
str
(
dest
))
@pytest.fixture
(
autouse
=
True
)
def
setup
(
mocker
):
# Patch git module to not actually clone projects
mocker
.
patch
(
"poetry.vcs.git.Git.clone"
,
new
=
mock_clone
)
mocker
.
patch
(
"poetry.vcs.git.Git.checkout"
,
new
=
lambda
*
_
:
None
)
p
=
mocker
.
patch
(
"poetry.vcs.git.Git.rev_parse"
)
p
.
return_value
=
"9cf87a285a2d3fbb0b9fa621997b3acc3631ed24"
yield
tests/puzzle/test_solver.py
View file @
6a927b5c
...
@@ -886,3 +886,10 @@ def test_solver_duplicate_dependencies_sub_dependencies(solver, repo, package):
...
@@ -886,3 +886,10 @@ def test_solver_duplicate_dependencies_sub_dependencies(solver, repo, package):
op
=
ops
[
3
]
op
=
ops
[
3
]
assert
op
.
package
.
requirements
==
{
"python"
:
">=3.4"
}
assert
op
.
package
.
requirements
==
{
"python"
:
">=3.4"
}
def
test_solver_fails_if_dependency_name_does_not_match_package
(
solver
,
repo
,
package
):
package
.
add_dependency
(
"my-demo"
,
{
"git"
:
"https://github.com/demo/demo.git"
})
with
pytest
.
raises
(
RuntimeError
):
solver
.
solve
()
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