Commit 66d36520 by June Oh Committed by GitHub

Fix neglected subdirectory in dependency lock (#7367)

parent 2cab0744
...@@ -378,6 +378,10 @@ class Locker: ...@@ -378,6 +378,10 @@ class Locker:
constraint["tag"] = dependency.tag constraint["tag"] = dependency.tag
elif dependency.rev: elif dependency.rev:
constraint["rev"] = dependency.rev constraint["rev"] = dependency.rev
if dependency.directory:
constraint["subdirectory"] = dependency.directory
else: else:
constraint["version"] = str(dependency.pretty_constraint) constraint["version"] = str(dependency.pretty_constraint)
......
...@@ -865,6 +865,15 @@ def test_locker_dumps_dependency_information_correctly( ...@@ -865,6 +865,15 @@ def test_locker_dumps_dependency_information_correctly(
"F", {"git": "https://github.com/python-poetry/poetry.git", "branch": "foo"} "F", {"git": "https://github.com/python-poetry/poetry.git", "branch": "foo"}
) )
) )
package_a.add_dependency(
Factory.create_dependency(
"G",
{
"git": "https://github.com/python-poetry/poetry.git",
"subdirectory": "bar",
},
)
)
packages = [package_a] packages = [package_a]
...@@ -891,6 +900,7 @@ C = {{path = "directory/project_with_transitive_directory_dependencies"}} ...@@ -891,6 +900,7 @@ C = {{path = "directory/project_with_transitive_directory_dependencies"}}
D = {{path = "distributions/demo-0.1.0.tar.gz"}} D = {{path = "distributions/demo-0.1.0.tar.gz"}}
E = {{url = "https://python-poetry.org/poetry-1.2.0.tar.gz"}} E = {{url = "https://python-poetry.org/poetry-1.2.0.tar.gz"}}
F = {{git = "https://github.com/python-poetry/poetry.git", branch = "foo"}} F = {{git = "https://github.com/python-poetry/poetry.git", branch = "foo"}}
G = {{git = "https://github.com/python-poetry/poetry.git", subdirectory = "bar"}}
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment