aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-07-09 22:13:33 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2023-07-09 22:13:33 +0300
commit123abbc101b4fafc25e3c288f9893dda7625c1de (patch)
tree25e568a4b46c4d93b751606e873127f9545750da /tests
parentOldPythonCompat: check for old PYTHON_COMPAT in modified ebuilds (diff)
downloadpkgcheck-123abbc101b4fafc25e3c288f9893dda7625c1de.tar.gz
pkgcheck-123abbc101b4fafc25e3c288f9893dda7625c1de.tar.bz2
pkgcheck-123abbc101b4fafc25e3c288f9893dda7625c1de.zip
scan: add `--git-remote` option to select remote
For repos with multiple remotes, it might be useful to select a specific remote to use (and not the default origin). This can be set using the `--git-remote` option for cmd call, or by adding `git-remote=value` to the config file. Resolves: https://github.com/pkgcore/pkgcheck/issues/600 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/addons/test_git.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/addons/test_git.py b/tests/addons/test_git.py
index da88d501..b896304d 100644
--- a/tests/addons/test_git.py
+++ b/tests/addons/test_git.py
@@ -71,7 +71,8 @@ class TestPkgcheckScanCommitsParseArgs:
options, _func = self.tool.parse_args(self.args + ["-r", local.path, "--commits"])
assert excinfo.value.code == 0
- def test_commits_existing(self, make_repo, make_git_repo, tmp_path):
+ @pytest.mark.parametrize("remote", ("origin", "pkgcheck"))
+ def test_commits_existing(self, remote, make_repo, make_git_repo, tmp_path):
# create parent repo
parent = make_repo()
origin = make_git_repo(parent.location, commit=True)
@@ -80,9 +81,9 @@ class TestPkgcheckScanCommitsParseArgs:
# create child repo and pull from parent
local = make_git_repo(str(tmp_path), commit=False)
- local.run(["git", "remote", "add", "origin", origin.path])
- local.run(["git", "pull", "origin", "main"])
- local.run(["git", "remote", "set-head", "origin", "main"])
+ local.run(["git", "remote", "add", remote, origin.path])
+ local.run(["git", "pull", remote, "main"])
+ local.run(["git", "remote", "set-head", remote, "main"])
child = make_repo(local.path)
# create local commits on child repo
@@ -91,7 +92,9 @@ class TestPkgcheckScanCommitsParseArgs:
child.create_ebuild("cat/pkg-2")
local.add_all("cat/pkg-2")
- options, _func = self.tool.parse_args(self.args + ["-r", local.path, "--commits"])
+ options, _func = self.tool.parse_args(
+ self.args + ["-r", local.path, "--commits", "--git-remote", remote]
+ )
atom_restricts = [atom_cls("cat/pkg")]
assert list(options.restrictions) == [
(base.package_scope, packages.OrRestriction(*atom_restricts))