Skip to content

Commit

Permalink
Use resolved references for vcs dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
koffie committed Sep 11, 2023
1 parent 02d5fcb commit 1832d8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/poetry_plugin_export/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _export_generic_txt(
continue
line += "-e "

requirement = dependency.to_pep_508(with_extras=False)
requirement = dependency.to_pep_508(with_extras=False, resolved=True)
is_direct_local_reference = (
dependency.is_file() or dependency.is_directory()
)
Expand Down
9 changes: 6 additions & 3 deletions tests/test_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ def test_exporter_can_export_requirements_txt_with_git_packages(
"type": "git",
"url": "https://github.com/foo/foo.git",
"reference": "123456",
"resolved_reference": "abcdef",
},
}
],
Expand All @@ -965,7 +966,7 @@ def test_exporter_can_export_requirements_txt_with_git_packages(
content = f.read()

expected = f"""\
foo @ git+https://github.com/foo/foo.git@123456 ; {MARKER_PY}
foo @ git+https://github.com/foo/foo.git@abcdef ; {MARKER_PY}
"""

assert content == expected
Expand All @@ -986,6 +987,7 @@ def test_exporter_can_export_requirements_txt_with_nested_packages(
"type": "git",
"url": "https://github.com/foo/foo.git",
"reference": "123456",
"resolved_reference": "abcdef",
},
},
{
Expand Down Expand Up @@ -1018,7 +1020,7 @@ def test_exporter_can_export_requirements_txt_with_nested_packages(

expected = f"""\
bar==4.5.6 ; {MARKER_PY}
foo @ git+https://github.com/foo/foo.git@123456 ; {MARKER_PY}
foo @ git+https://github.com/foo/foo.git@abcdef ; {MARKER_PY}
"""

assert content == expected
Expand Down Expand Up @@ -1199,6 +1201,7 @@ def test_exporter_can_export_requirements_txt_with_git_packages_and_markers(
"type": "git",
"url": "https://github.com/foo/foo.git",
"reference": "123456",
"resolved_reference": "abcdef",
},
}
],
Expand All @@ -1218,7 +1221,7 @@ def test_exporter_can_export_requirements_txt_with_git_packages_and_markers(
content = f.read()

expected = f"""\
foo @ git+https://github.com/foo/foo.git@123456 ; {MARKER_PY27.union(MARKER_PY36_ONLY)}
foo @ git+https://github.com/foo/foo.git@abcdef ; {MARKER_PY27.union(MARKER_PY36_ONLY)}
"""

assert content == expected
Expand Down

0 comments on commit 1832d8b

Please sign in to comment.