本文整理汇总了Python中tests.component.ComponentTestGitRepository类的典型用法代码示例。如果您正苦于以下问题:Python ComponentTestGitRepository类的具体用法?Python ComponentTestGitRepository怎么用?Python ComponentTestGitRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ComponentTestGitRepository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_bare
def test_bare(self):
"""Test that importing into bare repository works"""
dsc = self._dsc30('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
os.chdir('hello-debhelper')
assert len(repo.get_commits()) == 2
self._check_reflog(repo)
self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream'])
commitmsg = repo.get_commit_info('HEAD')['body']
ok_("hello-debhelper (2.6-2) unstable; urgency=medium" in commitmsg)
ok_("hello (1.3-7) experimental; urgency=LOW" in commitmsg)
dsc = self._dsc30('2.8-1')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dsc]) == 0
commits, expected = len(repo.get_commits()), 4
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
commitmsg = repo.get_commit_info('HEAD')['body']
ok_("hello-debhelper (2.8-1) unstable; urgency=low" in commitmsg)
ok_("ello-debhelper (2.7-1) unstable; urgency=low" in commitmsg)
ok_("hello-debhelper (2.6-2) unstable; urgency=medium" not in commitmsg)
开发者ID:agx,项目名称:git-buildpackage,代码行数:31,代码来源:test_import_dsc.py
示例2: test_create_branches
def test_create_branches(self):
"""Test if creating missing branches works"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR,
'dsc-3.0',
'hello-debhelper_%s.dsc' % version)
dsc = _dsc('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
os.chdir('hello-debhelper')
assert len(repo.get_commits()) == 2
reflog, ret = repo._git_getoutput('reflog')
ok_("gbp: Import Debian changes" in reflog[1])
ok_("gbp: Import Upstream version 2.6" in reflog[2])
self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream'])
dsc = _dsc('2.8-1')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=foo',
'--upstream-branch=bar',
'--create-missing-branches',
dsc]) == 0
self._check_repo_state(repo, 'master', ['bar', 'foo', 'master', 'pristine-tar', 'upstream'])
commits, expected = len(repo.get_commits()), 2
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
开发者ID:,项目名称:,代码行数:32,代码来源:
示例3: test_create_branches
def test_create_branches(self):
"""Test if creating missing branches works"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR, "dsc-3.0", "hello-debhelper_%s.dsc" % version)
dsc = _dsc("2.6-2")
assert (
import_dsc(
["arg0", "--verbose", "--pristine-tar", "--debian-branch=master", "--upstream-branch=upstream", dsc]
)
== 0
)
repo = ComponentTestGitRepository("hello-debhelper")
os.chdir("hello-debhelper")
assert len(repo.get_commits()) == 2
self._check_repo_state(repo, "master", ["master", "pristine-tar", "upstream"])
dsc = _dsc("2.8-1")
assert (
import_dsc(
[
"arg0",
"--verbose",
"--pristine-tar",
"--debian-branch=foo",
"--upstream-branch=bar",
"--create-missing-branches",
dsc,
]
)
== 0
)
self._check_repo_state(repo, "master", ["bar", "foo", "master", "pristine-tar", "upstream"])
commits, expected = len(repo.get_commits()), 2
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
开发者ID:kelleyk,项目名称:git-buildpackage,代码行数:35,代码来源:test_import_dsc.py
示例4: test_create_branches
def test_create_branches(self):
"""Test that creating missing branches works"""
dsc = self._dsc30('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
os.chdir('hello-debhelper')
assert len(repo.get_commits()) == 2
self._check_reflog(repo)
self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream'])
dsc = self._dsc30('2.8-1')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=foo',
'--upstream-branch=bar',
'--create-missing-branches',
dsc]) == 0
self._check_repo_state(repo, 'master', ['bar', 'foo', 'master', 'pristine-tar', 'upstream'])
commits, expected = len(repo.get_commits()), 2
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
开发者ID:agx,项目名称:git-buildpackage,代码行数:25,代码来源:test_import_dsc.py
示例5: test_invalid_config_file
def test_invalid_config_file(self):
"""Test invalid config file"""
# Create dummy invalid config file and try to import (should fail)
ComponentTestGitRepository.create('.')
with open('.gbp.conf', 'w') as conffd:
conffd.write('foobar\n')
eq_(mock_import(['foo']), 3)
self._check_log(0, 'gbp:error: File contains no section headers.')
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:8,代码来源:test_import_orig_rpm.py
示例6: test_update_component_tarballs
def test_update_component_tarballs(self):
"""
Test importing new version with additional tarballs works
"""
dsc = self._dsc('2.6-2')
ok_(import_dsc(['arg0', '--pristine-tar', dsc]) == 0)
repo = ComponentTestGitRepository(self.pkg)
os.chdir(self.pkg)
self._check_repo_state(repo, 'master', ['master', 'upstream', 'pristine-tar'])
# Import 2.8
orig = self._orig('2.8', dir='dsc-3.0-additional-tarballs')
ok_(import_orig(['arg0', '--component=foo', '--no-interactive', '--pristine-tar', orig]) == 0)
self._check_repo_state(repo, 'master', ['master', 'upstream', 'pristine-tar'],
tags=['debian/2.6-2', 'upstream/2.6', 'upstream/2.8'])
self._check_component_tarballs(repo, ['foo/test1', 'foo/test2'])
dsc = DscFile.parse(self._dsc('2.8-1', dir='dsc-3.0-additional-tarballs'))
# Check if we can rebuild the upstream tarball and additional tarball
ptars = [('hello-debhelper_2.8.orig.tar.gz', 'pristine-tar', '', dsc.tgz),
('hello-debhelper_2.8.orig-foo.tar.gz', 'pristine-tar^', 'foo', dsc.additional_tarballs['foo'])]
p = DebianPristineTar(repo)
outdir = os.path.abspath('.')
for f, w, s, o in ptars:
eq_(repo.get_subject(w), 'pristine-tar data for %s' % f)
old = self.hash_file(o)
p.checkout('hello-debhelper', '2.8', 'gzip', outdir, component=s)
out = os.path.join(outdir, f)
new = self.hash_file(out)
eq_(old, new, "Checksum %s of regenerated tarball %s does not match original %s" %
(f, old, new))
os.unlink(out)
# Import 2.9
orig = self._orig('2.9', dir='dsc-3.0-additional-tarballs')
ok_(import_orig(['arg0', '--component=foo', '--no-interactive', '--pristine-tar', orig]) == 0)
self._check_repo_state(repo, 'master', ['master', 'upstream', 'pristine-tar'],
tags=['debian/2.6-2', 'upstream/2.6', 'upstream/2.8', 'upstream/2.9'])
self._check_component_tarballs(repo, ['foo/test1', 'foo/test2', 'foo/test3'])
dsc = DscFile.parse(self._dsc('2.9-1', dir='dsc-3.0-additional-tarballs'))
# Check if we can rebuild the upstream tarball and additional tarball
ptars = [('hello-debhelper_2.9.orig.tar.gz', 'pristine-tar', '', dsc.tgz),
('hello-debhelper_2.9.orig-foo.tar.gz', 'pristine-tar^', 'foo', dsc.additional_tarballs['foo'])]
p = DebianPristineTar(repo)
outdir = os.path.abspath('.')
for f, w, s, o in ptars:
eq_(repo.get_subject(w), 'pristine-tar data for %s' % f)
old = self.hash_file(o)
p.checkout('hello-debhelper', '2.9', 'gzip', outdir, component=s)
new = self.hash_file(os.path.join(outdir, f))
eq_(old, new, "Checksum %s of regenerated tarball %s does not match original %s" %
(f, old, new))
开发者ID:,项目名称:,代码行数:55,代码来源:
示例7: test_clone_native
def test_clone_native(self, repo):
"""Test that cloning of debian native packages works"""
dest = os.path.join(self._tmpdir,
'cloned_repo')
clone(['arg0',
'--postclone=printenv > ../postclone.out',
repo.path, dest])
cloned = ComponentTestGitRepository(dest)
self._check_repo_state(cloned, 'master', ['master'])
assert len(cloned.get_commits()) == 1
self.check_hook_vars('../postclone', ["GBP_GIT_DIR"])
开发者ID:agx,项目名称:git-buildpackage,代码行数:11,代码来源:test_clone.py
示例8: test_download
def test_download(self):
def _dsc(version):
return os.path.join(DEB_TEST_DOWNLOAD_URL,
'dsc-native',
'git-buildpackage_%s.dsc' % version)
dsc = _dsc('0.4.14')
assert import_dsc(['arg0',
'--allow-unauthenticated',
dsc]) == 0
repo = ComponentTestGitRepository('git-buildpackage')
self._check_repo_state(repo, 'master', ['master'])
assert len(repo.get_commits()) == 1
开发者ID:,项目名称:,代码行数:12,代码来源:
示例9: test_import_10
def test_import_10(self):
"""Test if importing a 1.0 source format package works"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR,
'dsc-1.0',
'hello-debhelper_%s.dsc' % version)
dsc = _dsc('2.6-2')
assert import_dsc(['arg0', dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
self._check_repo_state(repo, 'master', ['master', 'upstream'],
tags=['upstream/2.6', 'debian/2.6-2'])
assert len(repo.get_commits()) == 2
开发者ID:,项目名称:,代码行数:13,代码来源:
示例10: test_upstream_branch_is_master
def test_upstream_branch_is_master(self):
"""Make sure we can import when upstream-branch == master (#750962)"""
dsc = self._dsc30('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--no-pristine-tar',
'--debian-branch=debian',
'--upstream-branch=master',
dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
self._check_repo_state(repo, 'debian', ['debian', 'master'])
commits, expected = len(repo.get_commits()), 2
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
开发者ID:agx,项目名称:git-buildpackage,代码行数:13,代码来源:test_import_dsc.py
示例11: test_debian_branch_not_master
def test_debian_branch_not_master(self):
"""Make sure we only have debian-branch and upstream-branch after an initial import"""
dsc = self._dsc30('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--no-pristine-tar',
'--debian-branch=pk4',
'--upstream-branch=upstream',
dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
self._check_repo_state(repo, 'pk4', ['pk4', 'upstream'])
commits, expected = len(repo.get_commits()), 2
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
开发者ID:agx,项目名称:git-buildpackage,代码行数:13,代码来源:test_import_dsc.py
示例12: test_import_debian_native
def test_import_debian_native(self):
"""Test that importing of debian native packages works"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR,
'dsc-native',
'git-buildpackage_%s.dsc' % version)
dsc1 = _dsc('0.4.14')
dsc2 = _dsc('0.4.15')
assert import_dscs(['arg0', dsc1, dsc2]) == 0
repo = ComponentTestGitRepository('git-buildpackage')
self._check_repo_state(repo, 'master', ['master'])
assert len(repo.get_commits()) == 2
commitmsg = repo.get_commit_info('HEAD')['body']
ok_("git-buildpackage (0.4.15) unstable; urgency=low" in commitmsg)
开发者ID:agx,项目名称:git-buildpackage,代码行数:15,代码来源:test_import_dscs.py
示例13: test_git_archive_tree_non_existent
def test_git_archive_tree_non_existent(self):
"""Test that we're failing tarball generation when commits are missing"""
pkg = 'hello-debhelper'
dsc = self._dsc_name(pkg, '2.8-1', 'dsc-3.0-additional-tarballs')
assert import_dsc(['arg0', '--no-pristine-tar', dsc]) == 0
repo = ComponentTestGitRepository(pkg)
os.chdir(pkg)
assert_false(repo.has_branch('pristine-tar'), "Pristine-tar branch not must exist")
ret = export_orig(['arg0',
'--component=bar', # non-existing component
'--no-pristine-tar'])
ok_(ret == 1, "Exporting tarballs must fail")
self._check_log(-1, "gbp:error: No tree for 'bar' found in "
"'upstream/2.8' to create additional tarball from")
开发者ID:agx,项目名称:git-buildpackage,代码行数:15,代码来源:test_export_orig.py
示例14: test_pristine_import_to_bare
def test_pristine_import_to_bare(self):
"""Test importing inside bare git repository"""
repo = ComponentTestGitRepository.create('.', bare=True)
orig = os.path.join(DATA_DIR, 'gbp-test-1.0.tar.bz2')
eq_(mock_import([orig]), 0)
# No pristine-tar branch should be present
self._check_repo_state(repo, 'master', ['master', 'upstream'])
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:7,代码来源:test_import_orig_rpm.py
示例15: test_clone_nonempty
def test_clone_nonempty(self):
"""Test that cloning into an existing dir fails"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR,
'dsc-native',
'git-buildpackage_%s.dsc' % version)
# Build up somethng we can clone from
dsc = _dsc('0.4.14')
assert import_dsc(['arg0', dsc]) == 0
repo = ComponentTestGitRepository('git-buildpackage')
self._check_repo_state(repo, 'master', ['master'])
assert len(repo.get_commits()) == 1
ok_(clone(['arg0', repo.path]) == 1,
"Cloning did no fail as expected")
self._check_log(-2, "gbp:error: Git command failed: Error running git clone: fatal: destination path 'git-buildpackage' already exists and is not an empty directory.")
开发者ID:,项目名称:,代码行数:17,代码来源:
示例16: test_hook_error
def test_hook_error(self):
"""Test postimport hook failure"""
repo = ComponentTestGitRepository.create('.')
orig = os.path.join(DATA_DIR, 'gbp-test-1.0.tar.bz2')
eq_(mock_import(['--postimport=/bin/false', '--merge', '--no-rollback', orig]), 1)
self._check_log(-2, "gbp:error: Postimport-hook '/bin/false' failed:")
self._check_log(-1, 'gbp:error: Import of %s failed' % orig)
# Other parts of the import should've succeeded
self._check_repo_state(repo, 'master', ['master', 'upstream'])
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:9,代码来源:test_import_orig_rpm.py
示例17: test_component_generation
def test_component_generation(self):
"""Test that generating tarball and additional tarball works without pristine-tar"""
pkg = 'hello-debhelper'
dsc = self._dsc_name(pkg, '2.8-1', 'dsc-3.0-additional-tarballs')
tarballs = ["../%s_2.8.orig-foo.tar.gz" % pkg,
"../%s_2.8.orig.tar.gz" % pkg]
assert import_dsc(['arg0', '--no-pristine-tar', dsc]) == 0
repo = ComponentTestGitRepository(pkg)
os.chdir(pkg)
assert_false(repo.has_branch('pristine-tar'), "Pristine-tar branch must not exist")
for t in tarballs:
self.assertFalse(os.path.exists(t), "Tarball %s must not exist" % t)
ret = export_orig(['arg0',
'--component=foo',
'--no-pristine-tar'])
ok_(ret == 0, "Exporting tarballs failed")
for t in tarballs:
self.assertTrue(os.path.exists(t), "Tarball %s not found" % t)
开发者ID:agx,项目名称:git-buildpackage,代码行数:19,代码来源:test_export_orig.py
示例18: test_import_zip
def test_import_zip(self):
"""Test importing of zip archive"""
repo = ComponentTestGitRepository.create('.')
# Import zip with, no master branch should be present
orig = os.path.join(DATA_DIR, 'gbp-test-native-1.0.zip')
files = ['.gbp.conf', 'packaging/gbp-test-native.spec',
'dummy.sh', 'README', 'Makefile']
eq_(mock_import([orig]), 0)
self._check_repo_state(repo, 'master', ['master', 'upstream'], files)
eq_(repo.get_tags(), ['upstream/1.0'])
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:10,代码来源:test_import_orig_rpm.py
示例19: test_branch_update
def test_branch_update(self):
"""Check that the working copy is kept in sync with branch HEAD"""
repo = ComponentTestGitRepository.create('.')
orig1 = os.path.join(DATA_DIR, 'gbp-test-1.0.tar.bz2')
orig2 = os.path.join(DATA_DIR, 'gbp-test-1.1.tar.bz2')
eq_(mock_import(['--merge', orig1]), 0)
repo.set_branch('upstream')
eq_(mock_import([orig2]), 0)
files = ['Makefile', 'README', 'dummy.sh']
self._check_repo_state(repo, 'upstream', ['master', 'upstream'], files)
eq_(len(repo.get_commits(until='upstream')), 2)
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:11,代码来源:test_import_orig_rpm.py
示例20: test_filter_with_component_tarballs
def test_filter_with_component_tarballs(self):
"""
Test that using a filter works even with component tarballs (#840602)
"""
dsc = self._dsc('2.6-2')
ok_(import_dsc(['arg0', '--pristine-tar', dsc]) == 0)
repo = ComponentTestGitRepository(self.pkg)
os.chdir(self.pkg)
self._check_repo_state(repo, 'master', ['master', 'upstream', 'pristine-tar'])
# copy data since we don't want the repacked tarball to end up in DEB_TEST_DATA_DIR
os.mkdir('../tarballs')
for f in ['hello-debhelper_2.8.orig-foo.tar.gz', 'hello-debhelper_2.8.orig.tar.gz']:
src = os.path.join(DEB_TEST_DATA_DIR, 'dsc-3.0-additional-tarballs', f)
shutil.copy(src, '../tarballs')
ok_(import_orig(['arg0',
'--component=foo',
'--no-interactive',
'--pristine-tar',
'--filter-pristine-tar',
'--filter=README*',
'../tarballs/hello-debhelper_2.8.orig.tar.gz']) == 0)
self._check_repo_state(repo, 'master', ['master', 'upstream', 'pristine-tar'],
tags=['debian/2.6-2', 'upstream/2.6', 'upstream/2.8'])
self._check_component_tarballs(repo, ['foo/test1', 'foo/test2'])
ok_('README' not in repo.ls_tree('HEAD'),
"README not filtered out of %s" % repo.ls_tree('HEAD'))
tar = '../hello-debhelper_2.8.orig.tar.gz'
# Check if tar got filtered properly
ok_(os.path.exists(tar))
t = tarfile.open(name=tar, mode="r:gz")
for f in ['hello-2.8/configure']:
i = t.getmember(f)
eq_(type(i), tarfile.TarInfo)
for f in ['hello-2.8/README']:
with assert_raises(KeyError):
t.getmember(f)
t.close()
开发者ID:,项目名称:,代码行数:41,代码来源:
注:本文中的tests.component.ComponentTestGitRepository类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论