Skip to content

Commit

Permalink
test_landings: increase git landing coverage (bug 1934485) (#190)
Browse files Browse the repository at this point in the history
* upgrade landings tests to work with both Hg and Git repos
* fix a few simple bugs in the Git implementation

---------

test_landings: update repo_mc factory to allow parameters
GitSCM.update_repo: use git fetch rather than pull
GitSCM: set Git user on local clone
test: ignore denyCurrentBranch in git repo fixture
test_landings: allow create_patch_revision to fetch normal patches by index
*SCM.apply_patch: add suffix to temporary files
tests: don't rstrip diff fixtures (git requires a trailing newline)
test_git: initialise test_repo with seed patch
tests: add git_repo to landings tests
test_landings: add repo_mc parametrable factory
test-landings: add hg_repo_mc fixture
conftest: dos2unix conversion

Co-authored-by: Connor Sheehan <[email protected]>
  • Loading branch information
shtrom and cgsheeh authored Jan 17, 2025
1 parent 07c2ef0 commit d780a9e
Show file tree
Hide file tree
Showing 8 changed files with 422 additions and 232 deletions.
11 changes: 8 additions & 3 deletions src/lando/api/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@
from lando.main.models import SCM_LEVEL_1, SCM_LEVEL_3, Profile, Repo
from lando.main.scm import SCM_TYPE_HG
from lando.main.support import LegacyAPIException
from lando.main.tests.conftest import git_repo, git_repo_seed
from lando.utils.phabricator import PhabricatorClient

# We need some local usage of those imported fixtures to satisfy the linters.
# This is it.
__all__ = ["git_repo", "git_repo_seed"]

PATCH_NORMAL_1 = r"""
# HG changeset patch
# User Test User <[email protected]>
Expand All @@ -45,7 +50,7 @@
@@ -1,1 +1,2 @@
TEST
+adding another line
""".strip()
""".lstrip()

PATCH_NORMAL_2 = r"""
# HG changeset patch
Expand All @@ -61,7 +66,7 @@
TEST
adding another line
+adding one more line
""".strip()
""".lstrip()

PATCH_NORMAL_3 = r"""
# HG changeset patch
Expand All @@ -82,7 +87,7 @@
+++ b/blah.txt
@@ -0,0 +1,1 @@
+TEST
""".strip()
""".lstrip()


@pytest.fixture
Expand Down
Loading

0 comments on commit d780a9e

Please sign in to comment.