Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ashnair1 committed Jun 14, 2022
1 parent 1c19d23 commit 884c2be
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/console/commands/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand Down
Binary file added tests/fixtures/distributions/demo-0.1.0.zip
Binary file not shown.

0 comments on commit 884c2be

Please sign in to comment.