Skip to content

Commit

Permalink
test(solver): test that vcs package with locked ref is not refetched
Browse files Browse the repository at this point in the history
  • Loading branch information
maksbotan committed Sep 4, 2022
1 parent 50269ff commit 10dc55b
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/puzzle/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
if TYPE_CHECKING:
import httpretty

from pytest_mock import MockerFixture

from poetry.installation.operations.operation import Operation
from poetry.puzzle.provider import Provider
from poetry.puzzle.transaction import Transaction
Expand Down Expand Up @@ -3511,6 +3513,40 @@ def test_solver_does_not_update_ref_of_locked_vcs_package(
)


def test_solver_does_not_fetch_locked_vcs_package_with_ref(
package: ProjectPackage,
repo: Repository,
pool: Pool,
io: NullIO,
mocker: MockerFixture,
):
locked_ref = "123456"
demo_locked = Package(
"demo",
"0.1.2",
source_type="git",
source_url="https://github.com/demo/demo.git",
source_reference=DEFAULT_SOURCE_REF,
source_resolved_reference=locked_ref,
)
demo_locked.add_dependency(Factory.create_dependency("pendulum", "*"))

package.add_dependency(
Factory.create_dependency("demo", {"git": "https://github.com/demo/demo.git"})
)

# transient dependencies of demo
pendulum = get_package("pendulum", "2.0.3")
repo.add_package(pendulum)

solver = Solver(package, pool, [], [demo_locked], io)
spy = mocker.spy(solver._provider, "_search_for_vcs")

solver.solve()

spy.assert_not_called()


def test_solver_direct_origin_dependency_with_extras_requested_by_other_package(
solver: Solver, repo: Repository, package: ProjectPackage
):
Expand Down

0 comments on commit 10dc55b

Please sign in to comment.