Skip to content

Commit

Permalink
Test case for circular dependency on root package
Browse files Browse the repository at this point in the history
  • Loading branch information
brechtm committed Dec 7, 2022
1 parent ab3a285 commit 706fccf
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/test_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,43 @@ def test_exporter_can_export_requirements_txt_with_nested_packages_cyclic(
assert content == expected


def test_exporter_can_export_requirements_txt_with_circular_dependency(
tmp_path: Path, poetry: Poetry
) -> None:
poetry.locker.mock_lock_data( # type: ignore[attr-defined]
{
"package": [
{
"name": "foo",
"version": "1.2.3",
"category": "main",
"optional": False,
"python-versions": "*",
"dependencies": {"my-package": {"version": "1.2.3"}},
},
],
"metadata": {
"python-versions": "*",
"content-hash": "123456789",
"files": {"foo": []},
},
}
)
set_package_requires(poetry)

exporter = Exporter(poetry, NullIO())
exporter.export("requirements.txt", tmp_path, "requirements.txt")

with (tmp_path / "requirements.txt").open(encoding="utf-8") as f:
content = f.read()

expected = f"""\
foo==1.2.3 ; {MARKER_PY}
"""

assert content == expected


def test_exporter_can_export_requirements_txt_with_nested_packages_and_multiple_markers(
tmp_path: Path, poetry: Poetry
) -> None:
Expand Down

0 comments on commit 706fccf

Please sign in to comment.