当前位置: 首页>>代码示例>>Python>>正文


Python ComponentTestGitRepository.create方法代码示例

本文整理汇总了Python中tests.component.ComponentTestGitRepository.create方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentTestGitRepository.create方法的具体用法?Python ComponentTestGitRepository.create怎么用?Python ComponentTestGitRepository.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tests.component.ComponentTestGitRepository的用法示例。


在下文中一共展示了ComponentTestGitRepository.create方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_invalid_config_file

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
 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,代码行数:10,代码来源:test_import_orig_rpm.py

示例2: test_pristine_import_to_bare

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
 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,代码行数:9,代码来源:test_import_orig_rpm.py

示例3: test_hook_error

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
 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,代码行数:11,代码来源:test_import_orig_rpm.py

示例4: test_import_zip

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
 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,代码行数:12,代码来源:test_import_orig_rpm.py

示例5: test_branch_update

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
 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,代码行数:13,代码来源:test_import_orig_rpm.py

示例6: test_import_hooks

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
    def test_import_hooks(self):
        """Basic test for postimport hook"""
        repo = ComponentTestGitRepository.create('.')
        orig = os.path.join(DATA_DIR, 'gbp-test-1.0.tar.bz2')

        script = ("echo -n branch: $GBP_BRANCH > ../hook.txt")
        eq_(mock_import(['--postimport', script, '--merge', orig]), 0)
        self._check_repo_state(repo, 'master', ['master', 'upstream'])
        eq_(repo.get_tags(), ['upstream/1.0'])
        with open('../hook.txt', 'r') as hookout:
            data = hookout.read()
        eq_(data, 'branch: master')
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:14,代码来源:test_import_orig_rpm.py

示例7: test_basic_import_to_bare_repo

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
    def test_basic_import_to_bare_repo(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)
        self._check_repo_state(repo, 'master', ['master', 'upstream'])
        eq_(len(repo.get_commits(until='upstream')), 1)
        eq_(repo.get_tags(), ['upstream/1.0'])

        # Import another version
        repo.set_branch('upstream')
        orig = os.path.join(DATA_DIR, 'gbp-test-1.1.tar.bz2')
        eq_(mock_import([orig]), 0)
        self._check_repo_state(repo, 'upstream', ['master', 'upstream'])
        eq_(len(repo.get_commits(until='upstream')), 2)
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:17,代码来源:test_import_orig_rpm.py

示例8: test_import_dir

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
    def test_import_dir(self):
        """Test importing of unpacked sources"""
        # Unpack sources and create repo
        orig = os.path.join(DATA_DIR, 'gbp-test-1.0.tar.bz2')
        subprocess.Popen(['tar', 'xf', orig])
        repo = ComponentTestGitRepository.create('myrepo')
        os.chdir('myrepo')

        # Import dir first, fool the version to be 0.9
        eq_(mock_import(['../gbp-test'], 'gbp-test\n0.9\n'), 0)
        files = ['Makefile', 'README', 'dummy.sh']
        self._check_repo_state(repo, 'master', ['master', 'upstream'], files)

        # Import from unpacked and check that the contents is the same
        eq_(mock_import([orig]), 0)
        eq_(len(repo.diff('upstream/0.9', 'upstream/1.0')), 0)
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:18,代码来源:test_import_orig_rpm.py

示例9: test_basic_filtering

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
    def test_basic_filtering(self):
        """Basic test for import filter"""
        repo = ComponentTestGitRepository.create('.')
        orig = os.path.join(DATA_DIR, 'gbp-test-1.1.with_dotgit.tar.bz2')
        # Try importing a tarball with git metadata
        eq_(mock_import([orig], 'gbp-test\n1.0\n'), 1)
        self._check_log(0, 'gbp:error: The orig tarball contains .git')

        # Try filtering out .git directory and shell scripts
        eq_(mock_import(['--filter=.git', '--filter=*.sh', '--merge', orig],
                        'gbp-test\n1.0\n'), 0)
        self._check_repo_state(repo, 'master', ['master', 'upstream'])
        eq_(len(repo.get_commits(until='master')), 1)
        eq_(len(repo.get_commits(until='upstream')), 1)
        eq_(repo.get_tags(), ['upstream/1.0'])
        added_files = repo.get_commit_info('upstream')['files']['A']
        eq_(set(added_files), set([b'Makefile', b'README']))
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:19,代码来源:test_import_orig_rpm.py

示例10: test_invalid_args

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
    def test_invalid_args(self):
        """
        See that import-orig-rpm fails gracefully when called with invalid args
        """
        repo = ComponentTestGitRepository.create('.')
        origs = [os.path.join(DATA_DIR, 'gbp-test-1.0.tar.bz2'),
                 os.path.join(DATA_DIR, 'gbp-test-1.1.tar.bz2')]
        # Test empty args
        eq_(mock_import([]), 1)
        self._clear_log()

        # Test multiple archives
        eq_(mock_import([] + origs), 1)
        self._check_log(0, 'gbp:error: More than one archive specified')
        self._clear_log()

        # Check that nothing is in the repo
        self._check_repo_state(repo, None, [])
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:20,代码来源:test_import_orig_rpm.py

示例11: test_noninteractive

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
    def test_noninteractive(self):
        """Test non-interactive mode"""
        repo = ComponentTestGitRepository.create('testrepo')
        orig = os.path.join(DATA_DIR, 'gbp-test-native-1.0.zip')
        orig_renamed = os.path.join(os.path.abspath('.'), 'foo.zip')
        shutil.copy(orig, orig_renamed)
        os.chdir('testrepo')

        # Guessing name and version should fail
        eq_(mock_import(['--no-interactive', orig_renamed]), 1)
        self._check_log(-1, "gbp:error: Couldn't determine upstream package")

        # Guessing from the original archive should succeed
        eq_(mock_import(['--no-interactive', '--merge', orig],
                        stdin_data=''), 0)
        files = ['.gbp.conf', 'Makefile', 'README', 'dummy.sh',
                 'packaging/gbp-test-native.spec']
        self._check_repo_state(repo, 'master', ['master', 'upstream'], files)
        eq_(len(repo.get_commits(until='master')), 1)
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:21,代码来源:test_import_orig_rpm.py

示例12: test_misc_options

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
    def test_misc_options(self):
        """Test various options of git-import-orig-rpm"""
        repo = ComponentTestGitRepository.create('.')
        # Force --no-ff for merges because default behavior is slightly
        # different in newer git versions (> 2.16)
        repo.set_config("branch.pack.mergeoptions", "--no-ff")

        # Import one orig with default options to get upstream and
        # packaging branch
        orig = os.path.join(DATA_DIR, 'gbp-test-1.0.tar.bz2')
        eq_(mock_import(['--debian-branch=pack',
                         '--upstream-branch=orig', '-u0.8', orig]), 0)
        self._check_repo_state(repo, 'pack', ['pack', 'orig'])

        # Import the "native" zip to get packaging files
        orig = os.path.join(DATA_DIR, 'gbp-test-native-1.0.zip')
        base_args = ['--debian-branch=pack', '--upstream-branch=orig',
                     '--upstream-tag=orig/%(version)s', '--merge']
        # Fake version to be 0.9
        extra_args = ['-u0.9', '--upstream-vcs-tag=upstream/0.8', orig]
        eq_(mock_import(base_args + extra_args), 0)
        # Check repository state
        files = ['dummy.sh', 'packaging/gbp-test-native.spec',
                 '.gbp.conf', 'Makefile', 'README']
        self._check_repo_state(repo, 'pack', ['pack', 'orig'], files)
        eq_(len(repo.get_commits(until='pack')), 3)
        # Check tags
        tags = repo.get_tags()
        eq_(set(tags), set(['upstream/0.8', 'orig/0.9']))

        # Change to packaging branch and create new commit
        repo.set_branch('pack')
        shutil.copy2('.git/HEAD', 'my_new_file')
        repo.add_files('.')
        repo.commit_all('My new commit')
        # Import a new version, name should be taken from spec
        orig = os.path.join(DATA_DIR, 'gbp-test-1.1.tar.bz2')
        extra_args = ['--no-interactive', '-u1.1', orig]
        eq_(mock_import(base_args + extra_args, ''), 0)
        # Threeupstream versions, "my new" commit and one merge commit
        eq_(len(repo.get_commits(until='pack')), 6)
        tags = repo.get_tags()
        eq_(set(tags), set(['upstream/0.8', 'orig/0.9', 'orig/1.1']))
开发者ID:agx,项目名称:git-buildpackage,代码行数:45,代码来源:test_import_orig_rpm.py

示例13: test_import_tars

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import create [as 别名]
    def test_import_tars(self):
        """Test importing of tarballs, with and without merging"""
        repo = ComponentTestGitRepository.create('.')
        # Import first version, with --merge
        orig = os.path.join(DATA_DIR, 'gbp-test-1.0.tar.bz2')
        eq_(mock_import(['--merge', orig]), 0)
        files = ['Makefile', 'README', 'dummy.sh']
        self._check_repo_state(repo, 'master', ['master', 'upstream'], files)
        eq_(len(repo.get_commits(until='master')), 1)
        eq_(len(repo.get_commits(until='upstream')), 1)
        eq_(repo.get_tags(), ['upstream/1.0'])

        # Import second version, don't merge to master branch
        orig = os.path.join(DATA_DIR, 'gbp-test-1.1.tar.bz2')
        eq_(mock_import(['--no-merge', orig]), 0)
        self._check_repo_state(repo, 'master', ['master', 'upstream'], files)
        eq_(len(repo.get_commits(until='master')), 1)
        eq_(len(repo.get_commits(until='upstream')), 2)
        eq_(repo.get_tags(), ['upstream/1.0', 'upstream/1.1'])
        # Check that master is based on v1.0
        sha1 = repo.rev_parse("%s^0" % 'upstream/1.0')
        eq_(repo.get_merge_base('master', 'upstream'), sha1)
开发者ID:marquiz,项目名称:git-buildpackage-rpm,代码行数:24,代码来源:test_import_orig_rpm.py


注:本文中的tests.component.ComponentTestGitRepository.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。