本文整理汇总了Python中qisrc.test.conftest.TestGit.call方法的典型用法代码示例。如果您正苦于以下问题:Python TestGit.call方法的具体用法?Python TestGit.call怎么用?Python TestGit.call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qisrc.test.conftest.TestGit
的用法示例。
在下文中一共展示了TestGit.call方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_publish_changes
# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import call [as 别名]
def test_publish_changes(qisrc_action, git_server):
foo_repo = git_server.create_repo("foo.git", review=True)
qisrc_action("init", git_server.manifest_url)
git_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
foo_git = TestGit(foo_proj.path)
foo_git.commit_file("a.txt", "a")
qisrc_action("push", "foo")
_, sha1 = foo_git.call("log", "-1", "--pretty=%H", raises=False)
(_, remote) = foo_git.call("ls-remote", "gerrit", "refs/for/master", raises=False)
assert remote == "%s\trefs/for/master" % sha1
示例2: test_not_under_code_review
# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import call [as 别名]
def test_not_under_code_review(qisrc_action, git_server):
foo_repo = git_server.create_repo("foo.git")
qisrc_action("init", git_server.manifest_url)
git_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
foo_git = TestGit(foo_proj.path)
foo_git.commit_file("a.txt", "a")
qisrc_action("push", "foo")
_, sha1 = foo_git.call("log", "-1", "--pretty=%H", raises=False)
(_, remote) = foo_git.call("ls-remote", "origin", "master", raises=False)
assert remote == "%s\trefs/heads/master" % sha1
示例3: test_ignores_env
# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import call [as 别名]
def test_ignores_env(tmpdir, monkeypatch):
repo1 = tmpdir.mkdir("repo1")
repo2 = tmpdir.mkdir("repo2")
git1 = TestGit(repo1.strpath)
git2 = TestGit(repo2.strpath)
git1.initialize()
git2.initialize()
untracked = repo1.join("untracked")
untracked.ensure(file=True)
monkeypatch.setenv("GIT_DIR", repo1.join(".git").strpath)
monkeypatch.setenv("GIT_WORK_TREE", repo1.strpath)
git2.call("clean", "--force")
assert untracked.check(file=1)
示例4: test_sync_branch_devel
# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import call [as 别名]
def test_sync_branch_devel(qisrc_action, git_server, test_git):
# This tests the case where everything goes smoothly
git_server.create_repo("foo.git")
qisrc_action("init", git_server.manifest_url)
git_server.push_file("foo.git", "foo.txt", "a super change")
git_server.push_file("foo.git", "bar.txt", "a super bugfix")
git_worktree = TestGitWorkTree()
foo = git_worktree.get_git_project("foo")
test_git = TestGit(foo.path)
test_git.call("checkout", "-b", "devel")
test_git.commit_file("developing.txt", "like a boss")
git_server.push_file("foo.git", "foobar.txt", "some other change")
git_server.push_file("foo.git", "bigchange.txt", "some huge change")
qisrc_action("sync", "--rebase-devel")
test_git.call("checkout", "master")
# Check that master is fast-forwarded
bigchange_txt = os.path.join(foo.path, "bigchange.txt")
assert os.path.exists(bigchange_txt)
# Check rebase is done smoothly
test_git.call("checkout", "devel")
test_git.call("rebase", "master")
assert os.path.exists(bigchange_txt)
developing_txt = os.path.join(foo.path, "developing.txt")
assert os.path.exists(developing_txt)
示例5: test_fixed_ref
# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import call [as 别名]
def test_fixed_ref(qisrc_action, git_server):
""" Test Fixed Ref """
git_server.create_repo("foo.git")
git_server.push_tag("foo.git", "v0.1")
git_server.set_fixed_ref("foo.git", "v0.1")
qisrc_action("init", git_server.manifest_url)
git_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
git = TestGit(foo_proj.path)
git.commit_file("a.txt", "a", "test")
qisrc_action("reset")
_, actual = git.call("rev-parse", "HEAD", raises=False)
_, expected = git.call("rev-parse", "v0.1", raises=False)
assert actual == expected
示例6: test_not_under_code_review_ask_user
# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import call [as 别名]
def test_not_under_code_review_ask_user(qisrc_action, git_server, interact):
""" Test Not Under Code Review Ask User """
_foo_repo = git_server.create_repo("foo.git")
qisrc_action("init", git_server.manifest_url)
git_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
foo_git = TestGit(foo_proj.path)
foo_git.commit_file("a.txt", "a")
interact.answers = [False, True]
qisrc_action("push", "--project", "foo")
_, sha1 = foo_git.call("log", "-1", "--pretty=%H", raises=False)
(_, remote) = foo_git.call("ls-remote", "origin", "master", raises=False)
assert remote != "%s\trefs/heads/master" % sha1
qisrc_action("push", "--project", "foo")
(_, remote) = foo_git.call("ls-remote", "origin", "master", raises=False)
assert remote == "%s\trefs/heads/master" % sha1
示例7: test_sync_branch_devel_no_ff
# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import call [as 别名]
def test_sync_branch_devel_no_ff(qisrc_action, git_server, test_git):
""" Test Sync Branc Devel No Fast Forward """
# Case where master can't be fast-forwarded, does nothing except warning
git_server.create_repo("foo.git")
qisrc_action("init", git_server.manifest_url)
git_server.push_file("foo.git", "foo.txt", "a super change")
git_worktree = TestGitWorkTree()
foo1 = git_worktree.get_git_project("foo")
test_git = TestGit(foo1.path)
test_git.commit_file("foo.git", "div.txt", "diverging from master")
master_sha1 = test_git.get_ref_sha1("refs/heads/master")
test_git.call("checkout", "-b", "devel")
test_git.commit_file("developing.txt", "like a boss")
git_server.push_file("foo.git", "foobar.txt", "some other change")
qisrc_action("sync", "--rebase-devel")
# Master HEAD is untouched
assert test_git.get_ref_sha1("refs/heads/master") == master_sha1
示例8: test_sync_branch_devel_unclean
# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import call [as 别名]
def test_sync_branch_devel_unclean(qisrc_action, git_server, test_git):
""" Test Sync Branch Devel UnClean """
# Case where the worktree isn't clean
git_server.create_repo("foo.git")
qisrc_action("init", git_server.manifest_url)
git_server.push_file("foo.git", "foo.txt", "a super change")
git_server.push_file("foo.git", "bar.txt", "a super bugfix")
git_worktree = TestGitWorkTree()
foo1 = git_worktree.get_git_project("foo")
test_git = TestGit(foo1.path)
test_git.call("checkout", "-b", "devel")
test_git.commit_file("developing.txt", "like a boss")
git_server.push_file("foo.git", "foobar.txt", "some other change")
wip_txt = os.path.join(foo1.path, "wip.txt")
open(wip_txt, 'w').close()
qisys.script.run_action("qisrc.actions.sync", ["--rebase-devel"])
# Master has been fast-forwarded and I haven't lost my WIP
assert os.path.exists(wip_txt)
示例9: test_rebase_conflict
# 需要导入模块: from qisrc.test.conftest import TestGit [as 别名]
# 或者: from qisrc.test.conftest.TestGit import call [as 别名]
def test_rebase_conflict(git_server, qisrc_action):
git_server.create_repo("foo")
git_server.switch_manifest_branch("devel")
git_server.change_branch("foo", "devel")
qisrc_action("init", git_server.manifest_url, "--branch", "devel")
git_server.push_file("foo", "foo.txt", "master")
git_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
git = TestGit(foo_proj.path)
git.commit_file("foo.txt", "devel")
git.push()
_, before = git.call("show", raises=False)
git.fetch()
# pylint: disable-msg=E1101
with pytest.raises(Exception):
qisrc_action("rebase", "--branch", "master", "--all")
_, after = git.call("show", raises=False)
assert after == before