Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing URL source option for multi-constraint dependencies #1819

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions poetry/json/schemas/poetry-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,9 @@
},
{
"$ref": "#/definitions/path-dependency"
},
{
"$ref": "#/definitions/url-dependency"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[tool.poetry]
name = "project-with-multi-constraint-types-dependency"
version = "1.2.3"
description = "This is a description"
authors = ["Your Name <you@example.com>"]
license = "MIT"

packages = [
{include = "project"}
]

[tool.poetry.dependencies]
python = "*"
demo = [
{ git = "https://github.com/demo/demo.git", rev = "9cf87a285a2d3fbb0b9fa621997b3acc3631ed24", python = "<3.4" },
{ path = "../distributions/demo-0.1.0-py2.py3-none-any.whl", python = "~3.5" },
{ url = "https://python-poetry.org/distributions/demo-0.1.0-py2.py3-none-any.whl", python = "^3.6" },
]

[tool.poetry.dev-dependencies]
15 changes: 15 additions & 0 deletions tests/masonry/builders/test_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,21 @@ def test_make_pkg_info_multi_constraints_dependency():
]


def test_make_pkg_info_multi_constraint_types_dependency():
poetry = Factory().create_poetry(
Path(__file__).parent.parent.parent
/ "fixtures"
/ "project_with_multi_constraint_types_dependency"
)

builder = SdistBuilder(poetry, NullEnv(), NullIO())
pkg_info = builder.build_pkg_info()
p = Parser()
parsed = p.parsestr(to_str(pkg_info))

assert "Requires-Dist" in parsed


def test_find_packages():
poetry = Factory().create_poetry(project("complete"))

Expand Down
10 changes: 10 additions & 0 deletions tests/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ def test_create_poetry_with_multi_constraints_dependency():
assert len(package.requires) == 2


def test_create_poetry_with_multi_constraint_types_dependency():
poetry = Factory().create_poetry(
fixtures_dir / "project_with_multi_constraint_types_dependency"
)

package = poetry.package

assert len(package.requires) == 3


def test_poetry_with_default_source():
poetry = Factory().create_poetry(fixtures_dir / "with_default_source")

Expand Down