From a31ac2ba34e8bc4f5f585734dcbb1bc173bcad29 Mon Sep 17 00:00:00 2001 From: Ashwin Nair Date: Wed, 2 Mar 2022 14:21:46 +0400 Subject: [PATCH] Add test --- tests/console/commands/plugin/test_add.py | 32 +++++++++++++++++++ .../subdir/poetry_plugin/__init__.py | 0 .../demo/poetry-plugin2/subdir/pyproject.toml | 18 +++++++++++ 3 files changed, 50 insertions(+) create mode 100644 tests/fixtures/git/github.com/demo/poetry-plugin2/subdir/poetry_plugin/__init__.py create mode 100644 tests/fixtures/git/github.com/demo/poetry-plugin2/subdir/pyproject.toml diff --git a/tests/console/commands/plugin/test_add.py b/tests/console/commands/plugin/test_add.py index 2eef6384972..97364cd3c5a 100644 --- a/tests/console/commands/plugin/test_add.py +++ b/tests/console/commands/plugin/test_add.py @@ -161,6 +161,38 @@ def test_add_with_git_constraint_with_extras( ) +def test_add_with_git_constraint_with_subdirectory( + app: PoetryTestApplication, + repo: TestRepository, + tester: CommandTester, + env: MockEnv, + installed: Repository, +): + repo.add_package(Package("pendulum", "2.0.5")) + + tester.execute("git+https://github.com/demo/poetry-plugin2.git#subdirectory=subdir") + + expected = """\ +Updating dependencies +Resolving dependencies... + +Writing lock file + +Package operations: 2 installs, 0 updates, 0 removals + + • Installing pendulum (2.0.5) + • Installing poetry-plugin (0.1.2 9cf87a2) +""" + + assert_plugin_add_result( + tester, + app, + env, + expected, + {"git": "https://github.com/demo/poetry-plugin2.git", "subdirectory": "subdir"}, + ) + + def test_add_existing_plugin_warns_about_no_operation( app: PoetryTestApplication, repo: TestRepository, diff --git a/tests/fixtures/git/github.com/demo/poetry-plugin2/subdir/poetry_plugin/__init__.py b/tests/fixtures/git/github.com/demo/poetry-plugin2/subdir/poetry_plugin/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/fixtures/git/github.com/demo/poetry-plugin2/subdir/pyproject.toml b/tests/fixtures/git/github.com/demo/poetry-plugin2/subdir/pyproject.toml new file mode 100644 index 00000000000..b45d9d976eb --- /dev/null +++ b/tests/fixtures/git/github.com/demo/poetry-plugin2/subdir/pyproject.toml @@ -0,0 +1,18 @@ +[tool.poetry] +name = "poetry-plugin" +version = "0.1.2" +description = "Some description." +authors = [ + "Sébastien Eustace " +] +license = "MIT" + +[tool.poetry.dependencies] +python = "^3.6" +pendulum = "^2.0" +tomlkit = {version = "^0.7.0", optional = true} + +[tool.poetry.extras] +foo = ["tomlkit"] + +[tool.poetry.dev-dependencies]