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


Python Process.check_call方法代码示例

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


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

示例1: testUpdateWithoutRevisionPin

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import check_call [as 别名]
    def testUpdateWithoutRevisionPin(self, develop, src, tempdir):
        from mr.developer.commands import CmdCheckout
        from mr.developer.commands import CmdUpdate
        repository = tempdir['repository']
        os.mkdir(repository)
        process = Process(cwd=repository)
        process.check_call("hg init %s" % repository)

        foo = repository['foo']
        foo.create_file('foo')
        process.check_call("hg add %s" % foo, echo=False)
        process.check_call("hg commit %s -m foo -u test" % foo, echo=False)
        bar = repository['bar']
        bar.create_file('bar')
        process.check_call("hg add %s" % bar, echo=False)
        process.check_call("hg commit %s -m bar -u test" % bar, echo=False)
        develop.sources = {
            'egg': Source(
                kind='hg',
                name='egg',
                url='%s' % repository,
                path=os.path.join(src, 'egg'))}
        _log = patch('mr.developer.mercurial.logger')
        log = _log.__enter__()
        try:
            CmdCheckout(develop)(develop.parser.parse_args(['co', 'egg']))
            assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.hg', 'bar', 'foo'))
            CmdUpdate(develop)(develop.parser.parse_args(['up', 'egg']))
            assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.hg', 'bar', 'foo'))
            assert log.method_calls == [
                ('info', ("Cloned 'egg' with mercurial.",), {}),
                ('info', ("Updated 'egg' with mercurial.",), {}),
                ('info', ("Switched 'egg' to default.",), {})]
        finally:
            _log.__exit__()
开发者ID:mvaled,项目名称:mr.developer,代码行数:37,代码来源:test_mercurial.py

示例2: testUpdateWithRevisionPin

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import check_call [as 别名]
 def testUpdateWithRevisionPin(self, develop, src, tempdir):
     from mr.developer.commands import CmdCheckout
     from mr.developer.commands import CmdUpdate
     process = Process()
     repository = tempdir['repository']
     process.check_call("svnadmin create %s" % repository)
     checkout = tempdir['checkout']
     process.check_call(
         "svn checkout file://%s %s" % (repository, checkout),
         echo=False)
     foo = checkout['foo']
     foo.create_file('foo')
     process.check_call("svn add %s" % foo, echo=False)
     process.check_call("svn commit %s -m foo" % foo, echo=False)
     bar = checkout['bar']
     bar.create_file('bar')
     process.check_call("svn add %s" % bar, echo=False)
     process.check_call("svn commit %s -m bar" % bar, echo=False)
     develop.sources = {
         'egg': Source(
             kind='svn',
             name='egg',
             url='file://%[email protected]' % repository,
             path=src['egg'])}
     CmdCheckout(develop)(develop.parser.parse_args(['co', 'egg']))
     assert set(os.listdir(src['egg'])) == set(('.svn', 'foo'))
     CmdUpdate(develop)(develop.parser.parse_args(['up', 'egg']))
     assert set(os.listdir(src['egg'])) == set(('.svn', 'foo'))
开发者ID:fschulze,项目名称:mr.developer,代码行数:30,代码来源:test_svn.py

示例3: testUpdateWithoutRevisionPin

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import check_call [as 别名]
 def testUpdateWithoutRevisionPin(self, develop, src, tempdir):
     from mr.developer.commands import CmdCheckout
     from mr.developer.commands import CmdUpdate
     process = Process()
     repository = tempdir['repository']
     process.check_call("svnadmin create %s" % repository)
     checkout = tempdir['checkout']
     process.check_call(
         "svn checkout file://%s %s" % (repository, checkout),
         echo=False)
     foo = checkout['foo']
     foo.create_file('foo')
     process.check_call("svn add %s" % foo, echo=False)
     process.check_call("svn commit %s -m foo" % foo, echo=False)
     bar = checkout['bar']
     bar.create_file('bar')
     process.check_call("svn add %s" % bar, echo=False)
     process.check_call("svn commit %s -m bar" % bar, echo=False)
     develop.sources = {
         'egg': Source(
             kind='svn',
             name='egg',
             url='file://%s' % repository,
             path=src['egg'])}
     _log = patch('mr.developer.svn.logger')
     log = _log.__enter__()
     try:
         CmdCheckout(develop)(develop.parser.parse_args(['co', 'egg']))
         assert set(os.listdir(src['egg'])) == set(('.svn', 'bar', 'foo'))
         CmdUpdate(develop)(develop.parser.parse_args(['up', 'egg']))
         assert set(os.listdir(src['egg'])) == set(('.svn', 'bar', 'foo'))
         assert log.method_calls == [
             ('info', ("Checked out 'egg' with subversion.",), {}),
             ('info', ("Updated 'egg' with subversion.",), {})]
     finally:
         _log.__exit__()
开发者ID:fschulze,项目名称:mr.developer,代码行数:38,代码来源:test_svn.py

示例4: testDepthOption

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import check_call [as 别名]
    def testDepthOption(self, mkgitrepo, src, tempdir):
        from mr.developer.develop import develop

        # create repository and make two commits on it
        repository = mkgitrepo('repository')
        self.createDefaultContent(repository)

        tempdir['buildout.cfg'].create_file(
            '[buildout]',
            'mr.developer-threads = 1',
            '[sources]',
            'egg = git %s' % repository.url)
        tempdir['.mr.developer.cfg'].create_file()
        # os.chdir(self.tempdir)
        develop('co', 'egg')

        # check that there are two commits in history
        egg_process = Process(cwd=src['egg'])
        lines = egg_process.check_call("git log", echo=False)
        commits = [msg for msg in lines
                   if msg.decode('utf-8').startswith('commit')]
        assert len(commits) == 2

        shutil.rmtree(src['egg'])

        tempdir['buildout.cfg'].create_file(
            '[buildout]',
            'mr.developer-threads = 1',
            '[sources]',
            'egg = git %s depth=1' % repository.url)
        develop('co', 'egg')

        # check that there is only one commit in history
        lines = egg_process.check_call("git log", echo=False)
        commits = [msg for msg in lines
                   if msg.decode('utf-8').startswith('commit')]
        assert len(commits) == 1

        shutil.rmtree(src['egg'])

        tempdir['buildout.cfg'].create_file(
            '[buildout]',
            'mr.developer-threads = 1',
            'git-clone-depth = 1',
            '[sources]',
            'egg = git %s' % repository.url)
        develop('co', 'egg')

        # check that there is only one commit in history
        lines = egg_process.check_call("git log", echo=False)
        commits = [msg for msg in lines
                   if msg.decode('utf-8').startswith('commit')]
        assert len(commits) == 1

        # You should be able to combine depth and cloning a branch.
        # Otherwise with a depth of 1 you could clone the master
        # branch and then not be able to switch to the wanted branch,
        # because this branch would not be there: the revision that it
        # points to is not in the downloaded history.
        shutil.rmtree(src['egg'])
        tempdir['buildout.cfg'].create_file(
            '[buildout]',
            'mr.developer-threads = 1',
            'git-clone-depth = 1',
            '[sources]',
            'egg = git %s branch=test' % repository.url)
        develop('co', 'egg')

        # check that there is only one commit in history
        lines = egg_process.check_call("git log", echo=False)
        commits = [msg for msg in lines
                   if msg.decode('utf-8').startswith('commit')]
        assert len(commits) == 1

        # Check that the expected files from the branch are there
        assert set(os.listdir(src['egg'])) == set(('.git', 'foo', 'foo2'))
开发者ID:fschulze,项目名称:mr.developer,代码行数:78,代码来源:test_git.py

示例5: testUpdateWithRevisionPin

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import check_call [as 别名]
    def testUpdateWithRevisionPin(self, develop, src, tempdir):
        from mr.developer.commands import CmdCheckout
        from mr.developer.commands import CmdUpdate
        repository = tempdir['repository']
        os.mkdir(repository)
        process = Process(cwd=repository)
        lines = process.check_call("hg init %s" % repository)
        foo = repository['foo']
        foo.create_file('foo')
        lines = process.check_call("hg add %s" % foo, echo=False)

        # create branch for testing
        lines = process.check_call("hg branch test", echo=False)

        lines = process.check_call("hg commit %s -m foo -u test" % foo, echo=False)

        # get comitted rev
        lines = process.check_call("hg log %s" % foo, echo=False)

        try:
            # XXX older version
            rev = lines[0].split()[1].split(b(':'))[1]
        except:
            rev = lines[0].split()[1]

        # return to default branch
        lines = process.check_call("hg branch default", echo=False)

        bar = repository['bar']
        bar.create_file('bar')
        lines = process.check_call("hg add %s" % bar, echo=False)
        lines = process.check_call("hg commit %s -m bar -u test" % bar, echo=False)

        # check rev
        develop.sources = {
            'egg': Source(
                kind='hg',
                name='egg',
                rev=rev,
                url='%s' % repository,
                path=os.path.join(src, 'egg'))}
        CmdCheckout(develop)(develop.parser.parse_args(['co', 'egg']))
        assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.hg', 'foo'))
        CmdUpdate(develop)(develop.parser.parse_args(['up', 'egg']))
        assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.hg', 'foo'))

        # check branch
        develop.sources = {
            'egg': Source(
                kind='hg',
                name='egg',
                branch='test',
                url='%s' % repository,
                path=os.path.join(src, 'egg'))}
        CmdCheckout(develop)(develop.parser.parse_args(['co', 'egg']))
        assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.hg', 'foo'))
        CmdUpdate(develop)(develop.parser.parse_args(['up', 'egg']))
        assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.hg', 'foo'))

        # we can't use both rev and branch
        pytest.raises(SystemExit, """
            develop.sources = {
                'egg': Source(
                    kind='hg',
                    name='egg',
                    branch='test',
                    rev=rev,
                    url='%s' % repository,
                    path=os.path.join(src, 'egg-failed'))}
            CmdCheckout(develop)(develop.parser.parse_args(['co', 'egg']))
        """)
开发者ID:mvaled,项目名称:mr.developer,代码行数:73,代码来源:test_mercurial.py


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