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
2f84178e
Commit
2f84178e
authored
Sep 22, 2019
by
Arun Babu Neelicattu
Committed by
Steph Samson
Sep 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enforce package name for poetry projects from directory source (#1327)
parent
cb8dc0d9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
10 deletions
+34
-10
poetry/puzzle/provider.py
+8
-8
tests/console/commands/test_add.py
+22
-0
tests/puzzle/test_provider.py
+4
-2
No files found.
poetry/puzzle/provider.py
View file @
2f84178e
...
...
@@ -353,14 +353,6 @@ class Provider:
package
=
Package
(
package_name
,
package_version
)
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
)
)
package
.
description
=
package_summary
for
req
in
reqs
:
...
...
@@ -378,6 +370,14 @@ class Provider:
if
python_requires
:
package
.
python_versions
=
python_requires
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
)
)
package
.
source_type
=
"directory"
package
.
source_url
=
dependency
.
path
.
as_posix
()
...
...
tests/console/commands/test_add.py
View file @
2f84178e
import
sys
import
pytest
from
cleo.testers
import
CommandTester
from
tests.helpers
import
get_dependency
...
...
@@ -173,6 +174,27 @@ Package operations: 2 installs, 0 updates, 0 removals
assert
len
(
installer
.
installs
)
==
2
def
test_add_git_constraint_with_poetry_bad_name
(
app
,
repo
,
installer
):
command
=
app
.
find
(
"add"
)
tester
=
CommandTester
(
command
)
repo
.
add_package
(
get_package
(
"pendulum"
,
"1.4.4"
))
with
pytest
.
raises
(
RuntimeError
)
as
e
:
tester
.
execute
(
[
(
"command"
,
command
.
get_name
()),
(
"name"
,
[
"demox"
]),
(
"--git"
,
"https://github.com/demo/pyproject-demo.git"
),
]
)
expected
=
(
"The dependency name for demox does not match the actual package's name: demo"
)
assert
str
(
e
.
value
)
==
expected
assert
len
(
installer
.
installs
)
==
0
def
test_add_file_constraint_wheel
(
app
,
repo
,
installer
):
command
=
app
.
find
(
"add"
)
tester
=
CommandTester
(
command
)
...
...
tests/puzzle/test_provider.py
View file @
2f84178e
...
...
@@ -251,7 +251,8 @@ def test_search_for_directory_setup_read_setup_with_no_dependencies(provider, mo
def
test_search_for_directory_poetry
(
provider
):
dependency
=
DirectoryDependency
(
"demo"
,
Path
(
__file__
)
.
parent
.
parent
/
"fixtures"
/
"project_with_extras"
"project-with-extras"
,
Path
(
__file__
)
.
parent
.
parent
/
"fixtures"
/
"project_with_extras"
,
)
package
=
provider
.
search_for_directory
(
dependency
)[
0
]
...
...
@@ -267,7 +268,8 @@ def test_search_for_directory_poetry(provider):
def
test_search_for_directory_poetry_with_extras
(
provider
):
dependency
=
DirectoryDependency
(
"demo"
,
Path
(
__file__
)
.
parent
.
parent
/
"fixtures"
/
"project_with_extras"
"project-with-extras"
,
Path
(
__file__
)
.
parent
.
parent
/
"fixtures"
/
"project_with_extras"
,
)
dependency
.
extras
.
append
(
"extras_a"
)
...
...
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