Skip to content

Commit 86afed1

Browse files
committed
Test case for circular dependency on root package
1 parent f61fa9f commit 86afed1

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
@@ -1115,6 +1115,43 @@ def test_exporter_can_export_requirements_txt_with_nested_packages_cyclic(
11151115
assert content == expected
11161116

11171117

1118+
def test_exporter_can_export_requirements_txt_with_circular_root_dependency(
1119+
tmp_path: Path, poetry: Poetry
1120+
) -> None:
1121+
poetry.locker.mock_lock_data( # type: ignore[attr-defined]
1122+
{
1123+
"package": [
1124+
{
1125+
"name": "foo",
1126+
"version": "1.2.3",
1127+
"category": "main",
1128+
"optional": False,
1129+
"python-versions": "*",
1130+
"dependencies": {poetry.package.pretty_name: {"version": "1.2.3"}},
1131+
},
1132+
],
1133+
"metadata": {
1134+
"python-versions": "*",
1135+
"content-hash": "123456789",
1136+
"files": {"foo": []},
1137+
},
1138+
}
1139+
)
1140+
set_package_requires(poetry)
1141+
1142+
exporter = Exporter(poetry, NullIO())
1143+
exporter.export("requirements.txt", tmp_path, "requirements.txt")
1144+
1145+
with (tmp_path / "requirements.txt").open(encoding="utf-8") as f:
1146+
content = f.read()
1147+
1148+
expected = f"""\
1149+
foo==1.2.3 ; {MARKER_PY}
1150+
"""
1151+
1152+
assert content == expected
1153+
1154+
11181155
def test_exporter_can_export_requirements_txt_with_nested_packages_and_multiple_markers(
11191156
tmp_path: Path, poetry: Poetry
11201157
) -> None:

0 commit comments

Comments
 (0)