Skip to content

Commit 30c66d8

Browse files
committed
Add tests
1 parent fec4531 commit 30c66d8

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

tests/console/commands/test_add.py

+40
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,46 @@ def test_add_url_constraint_wheel_with_extras(
747747
}
748748

749749

750+
def test_add_url_constraint_zip_with_subdir(
751+
app: PoetryTestApplication,
752+
repo: TestRepository,
753+
tester: CommandTester,
754+
mocker: MockerFixture,
755+
):
756+
p = mocker.patch("pathlib.Path.cwd")
757+
p.return_value = Path(__file__) / ".."
758+
759+
repo.add_package(get_package("pendulum", "1.4.4"))
760+
761+
tester.execute(
762+
"https://python-poetry.org/distributions/demo-0.1.0.zip#subdirectory=subdir"
763+
)
764+
765+
expected = """\
766+
767+
Updating dependencies
768+
Resolving dependencies...
769+
770+
Writing lock file
771+
772+
Package operations: 2 installs, 0 updates, 0 removals
773+
774+
• Installing pendulum (1.4.4)
775+
• Installing demo\
776+
(0.1.0 https://python-poetry.org/distributions/demo-0.1.0.zip)
777+
"""
778+
assert tester.io.fetch_output() == expected
779+
assert tester.command.installer.executor.installations_count == 2
780+
781+
content = app.poetry.file.read()["tool"]["poetry"]
782+
783+
assert "demo" in content["dependencies"]
784+
assert content["dependencies"]["demo"] == {
785+
"url": "https://python-poetry.org/distributions/demo-0.1.0.zip",
786+
"subdirectory": "subdir",
787+
}
788+
789+
750790
def test_add_constraint_with_python(
751791
app: PoetryTestApplication, repo: TestRepository, tester: CommandTester
752792
):
2.19 KB
Binary file not shown.

0 commit comments

Comments
 (0)