From 884c2bedea6c0d3c53a90397187c6992c4c15e7c Mon Sep 17 00:00:00 2001 From: Ashwin Nair Date: Thu, 9 Jun 2022 11:45:29 +0400 Subject: [PATCH] Add tests --- tests/console/commands/test_add.py | 40 ++++++++++++++++++++ tests/fixtures/distributions/demo-0.1.0.zip | Bin 0 -> 2246 bytes 2 files changed, 40 insertions(+) create mode 100644 tests/fixtures/distributions/demo-0.1.0.zip diff --git a/tests/console/commands/test_add.py b/tests/console/commands/test_add.py index 0dcc207ad21..317780781dd 100644 --- a/tests/console/commands/test_add.py +++ b/tests/console/commands/test_add.py @@ -688,6 +688,46 @@ def test_add_url_constraint_wheel_with_extras( } +def test_add_url_constraint_zip_with_subdir( + app: PoetryTestApplication, + repo: TestRepository, + tester: CommandTester, + mocker: MockerFixture, +): + p = mocker.patch("pathlib.Path.cwd") + p.return_value = Path(__file__) / ".." + + repo.add_package(get_package("pendulum", "1.4.4")) + + tester.execute( + "https://python-poetry.org/distributions/demo-0.1.0.zip#subdirectory=subdir" + ) + + expected = """\ + +Updating dependencies +Resolving dependencies... + +Writing lock file + +Package operations: 2 installs, 0 updates, 0 removals + + • Installing pendulum (1.4.4) + • Installing demo\ + (0.1.0 https://python-poetry.org/distributions/demo-0.1.0.zip) +""" + assert tester.io.fetch_output() == expected + assert tester.command.installer.executor.installations_count == 2 + + content = app.poetry.file.read()["tool"]["poetry"] + + assert "demo" in content["dependencies"] + assert content["dependencies"]["demo"] == { + "url": "https://python-poetry.org/distributions/demo-0.1.0.zip", + "subdirectory": "subdir", + } + + def test_add_constraint_with_python( app: PoetryTestApplication, repo: TestRepository, tester: CommandTester ): diff --git a/tests/fixtures/distributions/demo-0.1.0.zip b/tests/fixtures/distributions/demo-0.1.0.zip new file mode 100644 index 0000000000000000000000000000000000000000..e04197d6676bf309c6a6195af3dcf629d251d0d6 GIT binary patch literal 2246 zcmWIWW@Zs#00H;tlObRRl;CDiU`R>L&DS;1Gt@KC4-MgEV4t>NVG<0NR&X;gvbjBwG!4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