Skip to content

Commit 2e20004

Browse files
committed
Test case for circular dependency on root package
1 parent 9f64222 commit 2e20004

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/test_exporter.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,43 @@ def test_exporter_can_export_requirements_txt_with_nested_packages_cyclic(
11301130
assert content == expected
11311131

11321132

1133+
def test_exporter_can_export_requirements_txt_with_circular_dependency(
1134+
tmp_path: Path, poetry: Poetry
1135+
) -> None:
1136+
poetry.locker.mock_lock_data( # type: ignore[attr-defined]
1137+
{
1138+
"package": [
1139+
{
1140+
"name": "foo",
1141+
"version": "1.2.3",
1142+
"category": "main",
1143+
"optional": False,
1144+
"python-versions": "*",
1145+
"dependencies": {"my-package": {"version": "1.2.3"}},
1146+
},
1147+
],
1148+
"metadata": {
1149+
"python-versions": "*",
1150+
"content-hash": "123456789",
1151+
"files": {"foo": []},
1152+
},
1153+
}
1154+
)
1155+
set_package_requires(poetry)
1156+
1157+
exporter = Exporter(poetry, NullIO())
1158+
exporter.export("requirements.txt", tmp_path, "requirements.txt")
1159+
1160+
with (tmp_path / "requirements.txt").open(encoding="utf-8") as f:
1161+
content = f.read()
1162+
1163+
expected = f"""\
1164+
foo==1.2.3 ; {MARKER_PY}
1165+
"""
1166+
1167+
assert content == expected
1168+
1169+
11331170
def test_exporter_can_export_requirements_txt_with_nested_packages_and_multiple_markers(
11341171
tmp_path: Path, poetry: Poetry
11351172
) -> None:

0 commit comments

Comments
 (0)