-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow for empty choice while selecting dependencies
Fixes #2355 This works around an issue with cleo's `Command.choice` implementation. If the user does not make a selection then an AttributeError is raised.
- Loading branch information
1 parent
34ca165
commit d56242f
Showing
2 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,48 @@ def test_interactive_with_dependencies(tester, repo): | |
assert expected in tester.io.fetch_output() | ||
|
||
|
||
# Regression test for https://github.com/python-poetry/poetry/issues/2355 | ||
def test_interactive_with_dependencies_and_no_selection(tester, repo): | ||
repo.add_package(get_package("django-pendulum", "0.1.6-pre4")) | ||
repo.add_package(get_package("pendulum", "2.0.0")) | ||
repo.add_package(get_package("pytest", "3.6.0")) | ||
|
||
inputs = [ | ||
"my-package", # Package name | ||
"1.2.3", # Version | ||
"This is a description", # Description | ||
"n", # Author | ||
"MIT", # License | ||
"~2.7 || ^3.6", # Python | ||
"", # Interactive packages | ||
"pendulu", # Search for package | ||
"", # Do not select an option | ||
"", # Stop searching for packages | ||
"", # Interactive dev packages | ||
"pytest", # Search for package | ||
"", # Do not select an option | ||
"", | ||
"", | ||
"\n", # Generate | ||
] | ||
tester.execute(inputs="\n".join(inputs)) | ||
expected = """\ | ||
[tool.poetry] | ||
name = "my-package" | ||
version = "1.2.3" | ||
description = "This is a description" | ||
authors = ["Your Name <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "my_package"}] | ||
[tool.poetry.dependencies] | ||
python = "~2.7 || ^3.6" | ||
""" | ||
|
||
assert expected in tester.io.fetch_output() | ||
|
||
|
||
def test_empty_license(tester): | ||
inputs = [ | ||
"my-package", # Package name | ||
|