Loading tests/unit/gitlab_ci/pre_commit_run/fixtures.py +10 −7 Original line number Diff line number Diff line Loading @@ -135,13 +135,13 @@ def setup_fixture_repo(repo: Repo) -> None: The repository consists of three branches, two with common ancestors and one with no commonality with the other two: ┌──────────────────────────────────┐ ┌──────────────────────────────────────────┐ │ "lca" (Last common ancestor) │ │ ↓ │ │ ○─○─○─○─○─○─○─○─○─● "main" │ │ ○─○─○─○─○─○─○─○─○─● "main", tag:"test" │ │ └─○─○─○─○─● "fork" │ │ ○─○─○─○─○─○─○─○─○─● "orphan" │ └──────────────────────────────────┘ └──────────────────────────────────────────┘ """ random.seed(1) Loading @@ -157,6 +157,9 @@ def setup_fixture_repo(repo: Repo) -> None: orphan = Branch(repo, "orphan", create_commit(repo)) orphan.head = create_commit_path(repo, orphan.root, 5) # Make test tag repo.command("tag", "test", main.head) def create_commit_path(repo: Repo, source: Sha, number: int) -> Sha: """ Loading tests/unit/gitlab_ci/pre_commit_run/tests.py +9 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,15 @@ class PreCommitRunTests(unittest.TestCase): expect = ["run", "--all-files"] self.assertListEqual(expect, args) def test_tag(self) -> None: """ Check that pushing a tag works like pushing to a new branch """ args = self.run_script("refs/tags/test") expect = ["run", "--all-files"] self.assertListEqual(expect, args) def test_additional_arguments(self) -> None: """ Check additional arguments passed to pre_commit_run are passed to pre-commit Loading Loading
tests/unit/gitlab_ci/pre_commit_run/fixtures.py +10 −7 Original line number Diff line number Diff line Loading @@ -135,13 +135,13 @@ def setup_fixture_repo(repo: Repo) -> None: The repository consists of three branches, two with common ancestors and one with no commonality with the other two: ┌──────────────────────────────────┐ ┌──────────────────────────────────────────┐ │ "lca" (Last common ancestor) │ │ ↓ │ │ ○─○─○─○─○─○─○─○─○─● "main" │ │ ○─○─○─○─○─○─○─○─○─● "main", tag:"test" │ │ └─○─○─○─○─● "fork" │ │ ○─○─○─○─○─○─○─○─○─● "orphan" │ └──────────────────────────────────┘ └──────────────────────────────────────────┘ """ random.seed(1) Loading @@ -157,6 +157,9 @@ def setup_fixture_repo(repo: Repo) -> None: orphan = Branch(repo, "orphan", create_commit(repo)) orphan.head = create_commit_path(repo, orphan.root, 5) # Make test tag repo.command("tag", "test", main.head) def create_commit_path(repo: Repo, source: Sha, number: int) -> Sha: """ Loading
tests/unit/gitlab_ci/pre_commit_run/tests.py +9 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,15 @@ class PreCommitRunTests(unittest.TestCase): expect = ["run", "--all-files"] self.assertListEqual(expect, args) def test_tag(self) -> None: """ Check that pushing a tag works like pushing to a new branch """ args = self.run_script("refs/tags/test") expect = ["run", "--all-files"] self.assertListEqual(expect, args) def test_additional_arguments(self) -> None: """ Check additional arguments passed to pre_commit_run are passed to pre-commit Loading