From 44c60c4caed0c4474ca5dde205fe92f9a95b3e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Velinszky?= Date: Fri, 21 Feb 2020 07:45:52 -0800 Subject: [PATCH] Changed schema to support url in multi dependencies (#2035) --- poetry/json/schemas/poetry-schema.json | 3 +++ tests/json/test_poetry_schema.py | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/poetry/json/schemas/poetry-schema.json b/poetry/json/schemas/poetry-schema.json index 10aff39e502..e94b90d28cc 100644 --- a/poetry/json/schemas/poetry-schema.json +++ b/poetry/json/schemas/poetry-schema.json @@ -460,6 +460,9 @@ }, { "$ref": "#/definitions/path-dependency" + }, + { + "$ref": "#/definitions/url-dependency" } ] } diff --git a/tests/json/test_poetry_schema.py b/tests/json/test_poetry_schema.py index 3086242cf25..48ebcd2311a 100644 --- a/tests/json/test_poetry_schema.py +++ b/tests/json/test_poetry_schema.py @@ -14,8 +14,31 @@ def base_object(): } +@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