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


Python Process.popen方法代码示例

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


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

示例1: gitConfigUser

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import popen [as 别名]
 def gitConfigUser(self, repo):
     repository = os.path.join(self.tempdir, repo)
     process = Process(cwd=repository)
     rc, lines = process.popen('git config user.email "[email protected]"')
     assert rc == 0
     rc, lines = process.popen('git config user.name "Florian Schulze"')
     assert rc == 0
     return repository
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:10,代码来源:test_git_submodules.py

示例2: addSubmoduleToRepo

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import popen [as 别名]
 def addSubmoduleToRepo(self, repository, submodule_path, submodule_name):
     process = Process(cwd=repository)
     rc, lines = process.popen("git submodule add file:///%s %s" % (submodule_path, submodule_name))
     assert rc == 0
     rc, lines = process.popen("git add .gitmodules")
     assert rc == 0
     rc, lines = process.popen("git add %s" % submodule_name)
     assert rc == 0
     rc, lines = process.popen("git commit -m 'Add submodule %s'" % submodule_name)
开发者ID:sunbit,项目名称:mr.developer,代码行数:11,代码来源:test_git_submodules.py

示例3: createRepo

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import popen [as 别名]
 def createRepo(self, repo):
     repository = os.path.join(self.tempdir, repo)
     os.mkdir(repository)
     process = Process(cwd=repository)
     rc, lines = process.popen("git init")
     assert rc == 0
     rc, lines = process.popen('git config user.email "[email protected]"')
     assert rc == 0
     rc, lines = process.popen('git config user.name "Florian Schulze"')
     assert rc == 0
     return repository
开发者ID:angelaqiu,项目名称:mafia,代码行数:13,代码来源:test_git.py

示例4: addFileToRepo

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import popen [as 别名]
 def addFileToRepo(self, repository, fname):
     process = Process(cwd=repository)
     repo_file = os.path.join(repository, fname)
     self.mkfile(repo_file, fname)
     rc, lines = process.popen(
         "git add %s" % repo_file,
         echo=False)
     assert rc == 0
     rc, lines = process.popen(
         "git commit %s -m %s" % (repo_file, fname),
         echo=False)
     assert rc == 0
开发者ID:sunbit,项目名称:mr.developer,代码行数:14,代码来源:test_git_submodules.py

示例5: testUpdateWithoutRevisionPin

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

        foo = os.path.join(repository, 'foo')
        self.mkfile(foo, 'foo')
        rc, lines = process.popen(
            "hg add %s" % foo,
            echo=False)
        assert rc == 0
        rc, lines = process.popen(
            "hg commit %s -m foo -u test" % foo,
            echo=False)
        assert rc == 0
        bar = os.path.join(repository, 'bar')
        self.mkfile(bar, 'bar')
        rc, lines = process.popen(
            "hg add %s" % bar,
            echo=False)
        assert rc == 0
        rc, lines = process.popen(
            "hg commit %s -m bar -u test" % bar,
            echo=False)
        assert rc == 0
        src = os.path.join(self.tempdir, 'src')
        os.mkdir(src)
        develop = MockDevelop()
        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:bubenkoff,项目名称:mr.developer,代码行数:54,代码来源:test_mercurial.py

示例6: createRepo

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import popen [as 别名]
 def createRepo(self, repo):
     repository = os.path.join(self.tempdir, repo)
     os.mkdir(repository)
     process = Process(cwd=repository)
     rc, lines = process.popen("git init")
     assert rc == 0
     return repository
开发者ID:sunbit,项目名称:mr.developer,代码行数:9,代码来源:test_git_submodules.py

示例7: testUpdateWithoutRevisionPin

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import popen [as 别名]
 def testUpdateWithoutRevisionPin(self):
     from mr.developer.commands import CmdCheckout
     from mr.developer.commands import CmdUpdate
     repository = self.createRepo('repository')
     process = Process(cwd=repository)
     foo = os.path.join(repository, 'foo')
     self.mkfile(foo, 'foo')
     rc, lines = process.popen(
         "git add %s" % foo,
         echo=False)
     assert rc == 0
     rc, lines = process.popen(
         "git commit %s -m foo" % foo,
         echo=False)
     assert rc == 0
     bar = os.path.join(repository, 'bar')
     self.mkfile(bar, 'bar')
     rc, lines = process.popen(
         "git add %s" % bar,
         echo=False)
     assert rc == 0
     rc, lines = process.popen(
         "git commit %s -m bar" % bar,
         echo=False)
     assert rc == 0
     src = os.path.join(self.tempdir, 'src')
     develop = MockDevelop()
     develop.sources = {
         'egg': Source(
             kind='git',
             name='egg',
             url='file:///%s' % repository,
             path=os.path.join(src, 'egg'))}
     _log = patch('mr.developer.git.logger')
     log = _log.__enter__()
     try:
         CmdCheckout(develop)(develop.parser.parse_args(['co', 'egg']))
         assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.git', 'bar', 'foo'))
         CmdUpdate(develop)(develop.parser.parse_args(['up', 'egg']))
         assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.git', 'bar', 'foo'))
         assert log.method_calls == [
             ('info', ("Cloned 'egg' with git.",), {}),
             ('info', ("Updated 'egg' with git.",), {})]
     finally:
         _log.__exit__()
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:47,代码来源:test_git.py

示例8: testUpdateWithoutRevisionPin

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import popen [as 别名]
 def testUpdateWithoutRevisionPin(self):
     from mr.developer.develop import CmdCheckout
     from mr.developer.develop import CmdUpdate
     process = Process()
     repository = os.path.join(self.tempdir, 'repository')
     rc, lines = process.popen(
         "svnadmin create %s" % repository)
     assert rc == 0
     checkout = os.path.join(self.tempdir, 'checkout')
     rc, lines = process.popen(
         "svn checkout file://%s %s" % (repository, checkout),
         echo=False)
     assert rc == 0
     foo = os.path.join(checkout, 'foo')
     self.mkfile(foo, 'foo')
     rc, lines = process.popen(
         "svn add %s" % foo,
         echo=False)
     assert rc == 0
     rc, lines = process.popen(
         "svn commit %s -m foo" % foo,
         echo=False)
     assert rc == 0
     bar = os.path.join(checkout, 'bar')
     self.mkfile(bar, 'bar')
     rc, lines = process.popen(
         "svn add %s" % bar,
         echo=False)
     assert rc == 0
     rc, lines = process.popen(
         "svn commit %s -m bar" % bar,
         echo=False)
     assert rc == 0
     src = os.path.join(self.tempdir, 'src')
     develop = MockDevelop()
     develop.sources = {
         'egg': Source(
             kind='svn',
             name='egg',
             url='file://%s' % repository,
             path=os.path.join(src, 'egg'))}
     _log = patch('mr.developer.svn.logger')
     log = _log.__enter__()
     try:
         CmdCheckout(develop)(develop.parser.parse_args(['co', 'egg']))
         assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.svn', 'bar', 'foo'))
         CmdUpdate(develop)(develop.parser.parse_args(['up', 'egg']))
         assert set(os.listdir(os.path.join(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:MatthewWilkes,项目名称:mr.developer,代码行数:55,代码来源:test_svn.py

示例9: testUpdateWithRevisionPin

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import popen [as 别名]
 def testUpdateWithRevisionPin(self):
     from mr.developer.develop import CmdCheckout
     from mr.developer.develop import CmdUpdate
     process = Process()
     repository = os.path.join(self.tempdir, 'repository')
     rc, lines = process.popen(
         "svnadmin create %s" % repository)
     assert rc == 0
     checkout = os.path.join(self.tempdir, 'checkout')
     rc, lines = process.popen(
         "svn checkout file://%s %s" % (repository, checkout),
         echo=False)
     assert rc == 0
     foo = os.path.join(checkout, 'foo')
     self.mkfile(foo, 'foo')
     rc, lines = process.popen(
         "svn add %s" % foo,
         echo=False)
     assert rc == 0
     rc, lines = process.popen(
         "svn commit %s -m foo" % foo,
         echo=False)
     assert rc == 0
     bar = os.path.join(checkout, 'bar')
     self.mkfile(bar, 'bar')
     rc, lines = process.popen(
         "svn add %s" % bar,
         echo=False)
     assert rc == 0
     rc, lines = process.popen(
         "svn commit %s -m bar" % bar,
         echo=False)
     assert rc == 0
     src = os.path.join(self.tempdir, 'src')
     develop = MockDevelop()
     develop.sources = {
         'egg': Source(
             kind='svn',
             name='egg',
             url='file://%[email protected]' % 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(('.svn', 'foo'))
     CmdUpdate(develop)(develop.parser.parse_args(['up', 'egg']))
     assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.svn', 'foo'))
开发者ID:MatthewWilkes,项目名称:mr.developer,代码行数:47,代码来源:test_svn.py

示例10: testUpdateWithRevisionPin

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

        # create branch for testing
        rc, lines = process.popen(
            "hg branch test",
            echo=False)
        assert rc == 0

        rc, lines = process.popen(
            "hg commit %s -m foo -u test" % foo,
            echo=False)
        assert rc == 0

        # get comitted rev
        rc, lines = process.popen(
            "hg log %s" % foo,
            echo=False)
        assert rc == 0
        rev = lines[0].split()[1].split(':')[1]

        # return to default branch
        rc, lines = process.popen(
            "hg branch default",
            echo=False)
        assert rc == 0

        bar = os.path.join(repository, 'bar')
        self.mkfile(bar, 'bar')
        rc, lines = process.popen(
            "hg add %s" % bar,
            echo=False)
        assert rc == 0
        rc, lines = process.popen(
            "hg commit %s -m bar -u test" % bar,
            echo=False)
        assert rc == 0
        src = os.path.join(self.tempdir, 'src')
        os.mkdir(src)
        develop = MockDevelop()

        # 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:bubenkoff,项目名称:mr.developer,代码行数:94,代码来源:test_mercurial.py

示例11: testUpdateWithRevisionPin

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import popen [as 别名]
    def testUpdateWithRevisionPin(self):
        from mr.developer.develop import CmdCheckout
        from mr.developer.develop import CmdUpdate
        from mr.developer.develop import CmdStatus
        repository = self.createRepo('repository')
        process = Process(cwd=repository)
        foo = os.path.join(repository, 'foo')
        self.mkfile(foo, 'foo')
        rc, lines = process.popen(
            "git add %s" % foo,
            echo=False)
        assert rc == 0

        rc, lines = process.popen(
            "git commit -m 'Initial'",
            echo=False)
        assert rc == 0

        # create branch for testing
        rc, lines = process.popen(
            "git checkout -b test",
            echo=False)
        assert rc == 0

        foo2 = os.path.join(repository, 'foo2')
        self.mkfile(foo2, 'foo2')
        rc, lines = process.popen(
            "git add %s" % foo2,
            echo=False)
        assert rc == 0

        rc, lines = process.popen(
            "git commit -m foo",
            echo=False)
        assert rc == 0

        # get comitted rev
        rc, lines = process.popen(
            "git log",
            echo=False)
        assert rc == 0
        rev = lines[0].split()[1]

        # return to default branch
        rc, lines = process.popen(
            "git checkout master",
            echo=False)
        assert rc == 0

        bar = os.path.join(repository, 'bar')
        self.mkfile(bar, 'bar')
        rc, lines = process.popen(
            "git add %s" % bar,
            echo=False)
        assert rc == 0
        rc, lines = process.popen(
            "git commit -m bar",
            echo=False)
        assert rc == 0
        src = os.path.join(self.tempdir, 'src')
        os.mkdir(src)
        develop = MockDevelop()
        develop.sources_dir = src

        # check rev
        develop.sources = {
            'egg': Source(
                kind='git',
                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(('.git', 'foo', 'foo2'))
        CmdUpdate(develop)(develop.parser.parse_args(['up', 'egg']))
        assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.git', 'foo', 'foo2'))

        shutil.rmtree(os.path.join(src, 'egg'))

        # check branch
        develop.sources = {
            'egg': Source(
                kind='git',
                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(('.git', 'foo', 'foo2'))
        CmdUpdate(develop)(develop.parser.parse_args(['up', 'egg']))
        assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.git', 'foo', 'foo2'))

        CmdStatus(develop)(develop.parser.parse_args(['status']))

        # we can't use both rev and branch
        pytest.raises(SystemExit, """
            develop.sources = {
                'egg': Source(
                    kind='git',
                    name='egg',
#.........这里部分代码省略.........
开发者ID:angelaqiu,项目名称:mafia,代码行数:103,代码来源:test_git.py

示例12: testDepthOption

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

        # create repository and make two commits on it
        repository = self.createRepo('repository')
        process = Process(cwd=repository)
        foo = os.path.join(repository, 'foo')
        self.mkfile(foo, 'foo')
        rc, lines = process.popen(
            "git add %s" % foo,
            echo=False)
        assert rc == 0
        rc, lines = process.popen(
            "git commit %s -m foo" % foo,
            echo=False)
        assert rc == 0
        bar = os.path.join(repository, 'bar')
        self.mkfile(bar, 'bar')
        rc, lines = process.popen(
            "git add %s" % bar,
            echo=False)
        assert rc == 0
        rc, lines = process.popen(
            "git commit %s -m bar" % bar,
            echo=False)
        assert rc == 0

        src = os.path.join(self.tempdir, 'src')
        self.createFile(
            'buildout.cfg', [
                '[buildout]',
                'mr.developer-threads = 1',
                '[sources]',
                'egg = git file:///%s' % repository])
        self.createFile('.mr.developer.cfg', [])
        os.chdir(self.tempdir)
        develop('co', 'egg')

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

        shutil.rmtree(os.path.join(src, 'egg'))

        self.createFile(
            'buildout.cfg', [
                '[buildout]',
                'mr.developer-threads = 1',
                '[sources]',
                'egg = git file:///%s depth=1' % repository])
        develop('co', 'egg')

        # check that there is only one commit in history
        process = Process(cwd=os.path.join(src, 'egg'))
        rc, lines = process.popen(
            "git log",
            echo=False)
        assert rc == 0
        commits = [msg for msg in lines
                   if msg.decode('utf-8').startswith('commit')]
        assert len(commits) == 1

        shutil.rmtree(os.path.join(src, 'egg'))

        self.createFile(
            'buildout.cfg', [
                '[buildout]',
                'mr.developer-threads = 1',
                'git-clone-depth = 1',
                '[sources]',
                'egg = git file:///%s' % repository])
        develop('co', 'egg')

        # check that there is only one commit in history
        process = Process(cwd=os.path.join(src, 'egg'))
        rc, lines = process.popen(
            "git log",
            echo=False)
        assert rc == 0
        commits = [msg for msg in lines
                   if msg.decode('utf-8').startswith('commit')]
        assert len(commits) == 1
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:90,代码来源:test_git.py

示例13: createDefaultContent

# 需要导入模块: from mr.developer.tests.utils import Process [as 别名]
# 或者: from mr.developer.tests.utils.Process import popen [as 别名]
    def createDefaultContent(self, repository):
        # Create default content and branches in a repository.
        # Return a revision number.
        process = Process(cwd=repository)
        foo = os.path.join(repository, 'foo')
        self.mkfile(foo, 'foo')
        rc, lines = process.popen(
            "git add %s" % foo,
            echo=False)
        assert rc == 0

        rc, lines = process.popen(
            "git commit -m 'Initial'",
            echo=False)
        assert rc == 0

        # create branch for testing
        rc, lines = process.popen(
            "git checkout -b test",
            echo=False)
        assert rc == 0

        foo2 = os.path.join(repository, 'foo2')
        self.mkfile(foo2, 'foo2')
        rc, lines = process.popen(
            "git add %s" % foo2,
            echo=False)
        assert rc == 0

        rc, lines = process.popen(
            "git commit -m foo2",
            echo=False)
        assert rc == 0

        # get comitted rev
        rc, lines = process.popen(
            "git log",
            echo=False)
        assert rc == 0
        rev = lines[0].split()[1]

        # return to default branch
        rc, lines = process.popen(
            "git checkout master",
            echo=False)
        assert rc == 0

        bar = os.path.join(repository, 'bar')
        self.mkfile(bar, 'bar')
        rc, lines = process.popen(
            "git add %s" % bar,
            echo=False)
        assert rc == 0
        rc, lines = process.popen(
            "git commit -m bar",
            echo=False)
        assert rc == 0

        # Return revision of one of the commits, the one that adds the
        # foo2 file.
        return rev
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:63,代码来源:test_git.py

示例14: testDepthOption

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

        # create repository and make two commits on it
        repository = self.createRepo('repository')
        self.createDefaultContent(repository)
        process = Process(cwd=repository)

        src = os.path.join(self.tempdir, 'src')
        self.createFile(
            'buildout.cfg', [
                '[buildout]',
                'mr.developer-threads = 1',
                '[sources]',
                'egg = git file:///%s' % repository])
        self.createFile('.mr.developer.cfg', [])
        os.chdir(self.tempdir)
        develop('co', 'egg')

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

        shutil.rmtree(os.path.join(src, 'egg'))

        self.createFile(
            'buildout.cfg', [
                '[buildout]',
                'mr.developer-threads = 1',
                '[sources]',
                'egg = git file:///%s depth=1' % repository])
        develop('co', 'egg')

        # check that there is only one commit in history
        process = Process(cwd=os.path.join(src, 'egg'))
        rc, lines = process.popen(
            "git log",
            echo=False)
        assert rc == 0
        commits = [msg for msg in lines
                   if msg.decode('utf-8').startswith('commit')]
        assert len(commits) == 1

        shutil.rmtree(os.path.join(src, 'egg'))

        self.createFile(
            'buildout.cfg', [
                '[buildout]',
                'mr.developer-threads = 1',
                'git-clone-depth = 1',
                '[sources]',
                'egg = git file:///%s' % repository])
        develop('co', 'egg')

        # check that there is only one commit in history
        process = Process(cwd=os.path.join(src, 'egg'))
        rc, lines = process.popen(
            "git log",
            echo=False)
        assert rc == 0
        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(os.path.join(src, 'egg'))
        self.createFile(
            'buildout.cfg', [
                '[buildout]',
                'mr.developer-threads = 1',
                'git-clone-depth = 1',
                '[sources]',
                'egg = git file:///%s branch=test' % repository])
        develop('co', 'egg')

        # check that there is only one commit in history
        process = Process(cwd=os.path.join(src, 'egg'))
        rc, lines = process.popen(
            "git log",
            echo=False)
        assert rc == 0
        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(os.path.join(src, 'egg'))) == set(('.git', 'foo', 'foo2'))
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:99,代码来源:test_git.py


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