Skip to content

Commit

Permalink
test_landings: allow create_patch_revision to fetch normal patches by…
Browse files Browse the repository at this point in the history
… index
  • Loading branch information
shtrom committed Jan 10, 2025
1 parent a13da75 commit 40b6d0c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/lando/api/tests/test_landings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ def create_patch_revision(normal_patch):
normal_patch_0 = normal_patch(0)

def _create_patch_revision(number, patch=normal_patch_0):
"""Create revision number `number`, with patch text `patch`.
`patch` will default to the first normal patch fixture if unspecified. However,
if it explicitely set to None, the `normal_patch` fixture will be used to get
normal patch number `number-1`."""
if not patch:
patch = normal_patch(number - 1)
revision = Revision()
revision.revision_id = number
revision.diff_id = number
Expand Down Expand Up @@ -283,17 +290,17 @@ def factory(scm_type: str) -> Repo:
(
SCM_TYPE_GIT,
[
(1, {}),
(2, {}),
(1, {"patch": None}),
(2, {"patch": None}),
],
),
(SCM_TYPE_GIT, [(1, {"patch": LARGE_PATCH})]),
# Hg
(
SCM_TYPE_HG,
[
(1, {}),
(2, {}),
(1, {"patch": None}),
(2, {"patch": None}),
],
),
(SCM_TYPE_HG, [(1, {"patch": LARGE_PATCH})]),
Expand Down

0 comments on commit 40b6d0c

Please sign in to comment.