本文整理汇总了Python中qisrc.test.conftest.TestGitWorkTree类的典型用法代码示例。如果您正苦于以下问题:Python TestGitWorkTree类的具体用法?Python TestGitWorkTree怎么用?Python TestGitWorkTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestGitWorkTree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_switching_from_fixed_ref_to_branch_local_changes
def test_switching_from_fixed_ref_to_branch_local_changes(qisrc_action, git_server, record_messages):
""" Test Swithcing From Fixed Ref To Branch Local Changes """
git_server.create_repo("foo.git")
git_server.push_file("foo.git", "a.txt", "a")
git_server.push_tag("foo.git", "v0.1")
git_server.push_file("foo.git", "b.txt", "b")
git_server.push_tag("foo.git", "v0.2")
git_server.push_file("foo.git", "c.txt", "c")
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.write_file("a.txt", "unstaged changes")
git_server.set_branch("foo.git", "master")
record_messages.reset()
rc = qisrc_action("sync", retcode=True)
# ERROR message must be displayed to warn user
assert rc != 0
assert record_messages.find("unstaged changes")
_, sha1 = git.call("rev-parse", "HEAD", raises=False)
expected = git.get_ref_sha1("refs/tags/v0.1")
# git repo unchanged
assert sha1 == expected
git.call("reset", "--hard")
qisrc_action("sync", retcode=True)
# if modification is revert sync must be successful
assert git.get_current_branch() == "master"
开发者ID:aldebaran,项目名称:qibuild,代码行数:28,代码来源:test_qisrc_sync.py
示例2: test_qisrc_checkout_with_branch_to_ref
def test_qisrc_checkout_with_branch_to_ref(qisrc_action, git_server):
""" Test QiSrc Checkout With Branch to Ref """
manifest_url = git_server.manifest_url
git_server.create_repo("foo.git")
git_server.create_repo("bar.git")
git_server.push_file("foo.git", "a.txt", "a")
git_server.push_tag("foo.git", "v0.1")
git_server.push_file("foo.git", "b.txt", "b")
git_server.push_tag("bar.git", "v0.2")
git_server.push_file("bar.git", "c.txt", "b")
qisrc_action("init", manifest_url)
git_server.switch_manifest_branch("devel")
git_server.set_fixed_ref("foo.git", "v0.1")
git_server.set_fixed_ref("bar.git", "v0.2")
git_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
git = TestGit(foo_proj.path)
assert git.get_current_branch() == "master"
qisrc_action("checkout", "devel")
_, sha1 = git.call("rev-parse", "HEAD", raises=False)
expected = git.get_ref_sha1("refs/tags/v0.1")
assert sha1 == expected
bar_proj = git_worktree.get_git_project("bar")
bar_git = qisrc.git.Git(bar_proj.path)
_, sha1 = bar_git.call("rev-parse", "HEAD", raises=False)
expected = bar_git.get_ref_sha1("refs/tags/v0.2")
assert sha1 == expected
开发者ID:aldebaran,项目名称:qibuild,代码行数:27,代码来源:test_qisrc_checkout.py
示例3: test_check
def test_check(qisrc_action, git_server):
# Get a correct xml file from the server:
manifest_url = git_server.manifest_url
git_server.create_repo("foo.git")
qisrc_action("init", manifest_url)
# copy it to an other place, make a mistake, and run --check:
srv_xml = git_server.src.join("manifest", "manifest.xml")
manifest = qisrc.manifest.Manifest(srv_xml.strpath)
editable_path = qisrc_action.tmpdir.join("manifest.xml")
manifest.manifest_xml = editable_path.strpath
manifest.add_repo("doestnotexists.git", "nowhere", ["origin"])
manifest.dump()
rc = qisrc_action("check-manifest", editable_path.strpath,
retcode=True)
assert rc != 0
# running qisrc sync should still work:
qisrc_action("sync")
# this time create a correct xml and re-run --check:
git_server.create_repo("bar.git")
manifest = qisrc.manifest.Manifest(srv_xml.strpath)
editable_path = qisrc_action.tmpdir.join("manifest.xml")
manifest.manifest_xml = editable_path.strpath
manifest.dump()
qisrc_action("check-manifest", editable_path.strpath)
git_worktree = TestGitWorkTree()
assert git_worktree.get_git_project("bar")
# running qisrc sync just to be sure:
qisrc_action("sync")
开发者ID:Grimy,项目名称:qibuild,代码行数:33,代码来源:test_check_manifest.py
示例4: test_clone_new_repos
def test_clone_new_repos(qisrc_action, git_server):
git_server.create_repo("foo.git")
qisrc_action("init", git_server.manifest_url)
git_server.create_repo("bar.git")
qisrc_action("sync")
git_worktree = TestGitWorkTree()
assert git_worktree.get_git_project("bar")
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:7,代码来源:test_qisrc_sync.py
示例5: test_check_configures_review
def test_check_configures_review(qisrc_action, git_server):
# Get a correct xml file from the server:
manifest_url = git_server.manifest_url
qisrc_action("init", manifest_url)
git_server.create_repo("foo.git")
git_server._create_repo("foo.git", review=True)
# Create a foo repo, but without code review set
foo_proj = qisrc_action.create_git_project("foo")
assert not foo_proj.review
# Edit the manifest.xml to set code review for foo
srv_xml = git_server.src.join("manifest", "manifest.xml")
manifest = qisrc.manifest.Manifest(srv_xml.strpath)
editable_path = qisrc_action.tmpdir.join("manifest.xml")
manifest.manifest_xml = editable_path.strpath
foo_repo = manifest.get_repo("foo.git")
foo_repo.remote_names = ["origin", "gerrit"]
manifest.dump()
# Run qisrc check-manifest
qisrc_action("check-manifest", editable_path.strpath)
# Code review should be now set:
git_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
assert foo_proj.review
开发者ID:alkino,项目名称:qibuild,代码行数:31,代码来源:test_check_manifest.py
示例6: test_uses_build_deps_by_default
def test_uses_build_deps_by_default(qisrc_action, git_server):
git_server.add_qibuild_test_project("world")
git_server.add_qibuild_test_project("hello")
git_server.create_repo("foo.git")
qisrc_action("init", git_server.manifest_url)
# Crete some changes in foo and world
git_server.push_file("foo.git", "foo.txt", "unrelated changes")
git_server.push_file("world.git", "world.txt", "dependency has been updated")
# Sync hello
qisrc_action.chdir("hello")
qisrc_action("sync")
qisrc_action.chdir(qisrc_action.root)
git_worktree = TestGitWorkTree()
# foo is not a dep, should not have changed:
foo_proj = git_worktree.get_git_project("foo")
foo_txt = os.path.join(foo_proj.path, "foo.txt")
assert not os.path.exists(foo_txt)
# World is a dep of hello:
world_proj = git_worktree.get_git_project("world")
world_txt = os.path.join(world_proj.path, "world.txt")
assert os.path.exists(world_txt)
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:25,代码来源:test_qisrc_sync.py
示例7: test_sync_branch_devel
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)
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:29,代码来源:test_qisrc_sync.py
示例8: test_creates_required_subdirs
def test_creates_required_subdirs(qisrc_action, git_server):
""" Test Create Required SubDirs """
git_server.create_repo("foo/bar.git")
qisrc_action("init", git_server.manifest_url)
qisrc_action("sync")
git_worktree = TestGitWorkTree()
assert git_worktree.get_git_project("foo/bar")
开发者ID:aldebaran,项目名称:qibuild,代码行数:7,代码来源:test_qisrc_sync.py
示例9: test_using_checkout_after_no_review
def test_using_checkout_after_no_review(qisrc_action, git_server):
git_server.create_repo("foo", review=True)
qisrc_action("init", git_server.manifest_url, "--no-review")
git_server.switch_manifest_branch("devel")
qisrc_action("checkout", "devel")
git_worktree = TestGitWorkTree()
foo = git_worktree.get_git_project("foo")
assert not foo.review
开发者ID:Phlogistique,项目名称:qibuild,代码行数:8,代码来源:test_qisrc_init.py
示例10: test_not_on_any_branch
def test_not_on_any_branch(qisrc_action, record_messages):
git_worktree = TestGitWorkTree()
foo = git_worktree.create_git_project("foo")
foo_git = qisrc.git.Git(foo.path)
(rc, out) = foo_git.call("log", "-1", "HEAD", "--pretty=%H", raises=False)
foo_git.checkout(out)
qisrc_action("status")
assert record_messages.find("not on any branch")
开发者ID:Giessen,项目名称:qibuild,代码行数:8,代码来源:test_qisrc_status.py
示例11: test_configure_new_repos
def test_configure_new_repos(qisrc_action, git_server):
git_server.create_repo("foo.git")
qisrc_action("init", git_server.manifest_url)
qisrc_action("sync")
git_server.create_repo("bar.git")
qisrc_action("sync", "foo") # Sync only foo, but expect to clone bar
git_worktree = TestGitWorkTree()
bar = git_worktree.get_git_project("bar")
assert bar.default_remote
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:9,代码来源:test_qisrc_sync.py
示例12: test_retcode_when_skipping
def test_retcode_when_skipping(qisrc_action, git_server):
git_server.create_repo("bar")
qisrc_action("init", git_server.manifest_url)
git_worktree = TestGitWorkTree()
bar_proj = git_worktree.get_git_project("bar")
git = TestGit(bar_proj.path)
git.checkout("-b", "devel")
rc = qisrc_action("sync", retcode=True)
assert rc != 0
开发者ID:Mhalla,项目名称:qibuild,代码行数:9,代码来源:test_qisrc_sync.py
示例13: test_does_not_store_if_setup_fails
def test_does_not_store_if_setup_fails(git_worktree, git_server):
git_server.create_repo("foo", review=True)
manifest_url = git_server.manifest_url
worktree_syncer = qisrc.sync.WorkTreeSyncer(git_worktree)
with mock.patch("qisrc.review.setup_project") as mock_setup:
mock_setup.return_value = False
worktree_syncer.configure_manifest(manifest_url)
git_worktree2 = TestGitWorkTree()
foo = git_worktree2.get_git_project("foo")
assert foo.review is False
开发者ID:Mhalla,项目名称:qibuild,代码行数:10,代码来源:test_sync_review.py
示例14: test_re_add_removed_by_hand
def test_re_add_removed_by_hand(qisrc_action, git_server):
manifest_url = git_server.manifest_url
setup_re_add(qisrc_action, git_server)
git_worktree = TestGitWorkTree()
c_path = git_worktree.get_git_project("c").path
qisrc_action("init", manifest_url, "--group", "mygroup")
qisys.sh.rm(c_path)
qisrc_action("init", manifest_url)
git_worktree = TestGitWorkTree()
assert len(git_worktree.git_projects) == 3
开发者ID:Phlogistique,项目名称:qibuild,代码行数:10,代码来源:test_qisrc_init.py
示例15: test_re_add_path_exists
def test_re_add_path_exists(qisrc_action, git_server):
setup_re_add(qisrc_action, git_server)
git_worktree = TestGitWorkTree()
c_path = git_worktree.get_git_project("c").path
qisrc_action("manifest", "default", "--group", "mygroup")
qisys.sh.rm(c_path)
qisys.sh.mkdir(c_path)
qisrc_action("manifest", "default")
git_worktree = TestGitWorkTree()
assert len(git_worktree.git_projects) == 3
开发者ID:Giessen,项目名称:qibuild,代码行数:10,代码来源:test_qisrc_manifest.py
示例16: _test_switching_to_fixed_ref_happy
def _test_switching_to_fixed_ref_happy(qisrc_action, git_server, record_messages, tag_ref_to_test, branch_ref_to_test):
""" Test Switching To Fixed Ref Happy """
git_server.create_repo("foo.git")
git_server.push_file("foo.git", "a.txt", "a")
git_server.push_tag("foo.git", "v0.1")
git_server.push_file("foo.git", "b.txt", "b")
git_server.push_branch("foo.git", "feature/b")
git_server.push_file("foo.git", "c.txt", "c")
qisrc_action("init", git_server.manifest_url)
# Check for fixed_ref tag
git_server.set_fixed_ref("foo.git", tag_ref_to_test)
qisrc_action("sync")
git_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
git = qisrc.git.Git(foo_proj.path)
_, sha1 = git.call("rev-parse", "HEAD", raises=False)
expected = git.get_ref_sha1("refs/tags/v0.1")
assert sha1 == expected
# qisrc.reset.clever_reset_ref should tell where is the HEAD after reset
record_messages.reset()
qisrc_action("sync")
assert record_messages.find("HEAD is now at")
assert record_messages.find("Add a.txt")
_, status_output = git.status(raises=False)
assert "HEAD" in status_output
assert "detached" in status_output
# If branch ref name is local, makesure it exists on local copy, then go back to master
if branch_ref_to_test == "feature/b":
git.checkout("feature/b", raises=False)
git.checkout("master", raises=False)
# Check for fixed_ref branch
git_server.set_fixed_ref("foo.git", branch_ref_to_test)
qisrc_action("sync")
git_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
git = qisrc.git.Git(foo_proj.path)
_, sha1 = git.call("rev-parse", "HEAD", raises=False)
expected = git.get_ref_sha1("refs/remotes/origin/feature/b")
assert sha1 == expected
# qisrc.reset.clever_reset_ref should tell where is the HEAD after reset
record_messages.reset()
qisrc_action("sync")
assert record_messages.find("HEAD is now at")
assert record_messages.find("Add b.txt")
_, status_output = git.status(raises=False)
# FIXME: when using ref long name branch (refs/xxx), if we come from a tag, we stay in a detached head,
# and we should be in an attached head state to be consistent with the ref short name branc behaviour
# That's not an issue for now as users reference short name in manifest, but it will be cleaner to be consistent...
if not branch_ref_to_test.startswith("refs/"):
assert "HEAD" not in status_output
assert "detached" not in status_output
else:
# Remove these assert when dealing with behaviour consistency mentionned above
assert "HEAD" in status_output
assert "detached" in status_output
开发者ID:aldebaran,项目名称:qibuild,代码行数:55,代码来源:test_qisrc_sync.py
示例17: test_moving_repos_sync_action
def test_moving_repos_sync_action(git_worktree, git_server, qisrc_action):
git_server.create_repo("lib/foo.git")
manifest_url = git_server.manifest_url
git_worktree.configure_manifest("default", manifest_url)
git_server.move_repo("lib/foo.git", "lib/bar")
qisrc_action("sync")
git_worktree = TestGitWorkTree()
assert not git_worktree.get_git_project("lib/foo")
assert git_worktree.get_git_project("lib/bar")
# Sync twice just to test that nothing happens
qisrc_action("sync")
开发者ID:Giessen,项目名称:qibuild,代码行数:11,代码来源:test_sync_manifest.py
示例18: test_reset_undo_local_changes
def test_reset_undo_local_changes(qisrc_action, git_server):
git_server.create_repo("foo")
manifest_url = git_server.manifest_url
qisrc_action("init", manifest_url)
git_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
foo_git = TestGit(foo_proj.path)
orig_gitinore = foo_git.read_file(".gitignore")
foo_git.root.join(".gitignore").write("new line\n")
qisrc_action("reset", "--force")
assert foo_git.read_file(".gitignore") == orig_gitinore
开发者ID:alkino,项目名称:qibuild,代码行数:11,代码来源:test_qisrc_reset.py
示例19: test_behind
def test_behind(qisrc_action, git_server, record_messages):
git_server.create_repo("foo.git")
git_server.create_repo("bar.git")
qisrc_action("manifest", "--add", "default", git_server.manifest_url)
git_worktree = TestGitWorkTree()
foo = git_worktree.get_git_project("foo")
git_server.push_file("foo.git", "new_file", "")
foo_git = qisrc.git.Git(foo.path)
foo_git.fetch()
qisrc_action("status")
assert record_messages.find("foo : master tracking -1")
开发者ID:Giessen,项目名称:qibuild,代码行数:11,代码来源:test_qisrc_status.py
示例20: test_skip_when_not_on_correct_branch
def test_skip_when_not_on_correct_branch(git_server, qisrc_action, record_messages):
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_worktree = TestGitWorkTree()
foo_proj = git_worktree.get_git_project("foo")
git = TestGit(foo_proj.path)
git.checkout("-B", "perso")
qisrc_action("rebase", "--branch", "master", "--all")
assert record_messages.find("skipped")
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:11,代码来源:test_qisrc_rebase.py
注:本文中的qisrc.test.conftest.TestGitWorkTree类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论