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

Allow url dependencies in multiple constraints dependencies #32

Merged
merged 1 commit into from
Jun 5, 2020
Merged
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/core/json/schemas/poetry-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,9 @@
},
{
"$ref": "#/definitions/path-dependency"
},
{
"$ref": "#/definitions/url-dependency"
}
]
}
Expand Down
Empty file added tests/json/__init__.py
Empty file.
44 changes: 44 additions & 0 deletions tests/json/test_poetry_schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import pytest

from poetry.core.json import validate_object


@pytest.fixture
def base_object():
return {
"name": "myapp",
"version": "1.0.0",
"description": "Some description.",
"dependencies": {"python": "^3.6"},
"dev-dependencies": {},
}


@pytest.fixture
def multi_url_object():
return {
"name": "myapp",
"version": "1.0.0",
"description": "Some description.",
"dependencies": {
"python": [
{
"url": "https://download.pytorch.org/whl/cpu/torch-1.4.0%2Bcpu-cp37-cp37m-linux_x86_64.whl",
"platform": "linux",
},
{"path": "../foo", "platform": "darwin"},
]
},
"dev-dependencies": {},
}


def test_path_dependencies(base_object):
base_object["dependencies"].update({"foo": {"path": "../foo"}})
base_object["dev-dependencies"].update({"foo": {"path": "../foo"}})

assert len(validate_object(base_object, "poetry-schema")) == 0


def test_multi_url_dependencies(multi_url_object):
assert len(validate_object(multi_url_object, "poetry-schema")) == 0