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


Python utils.Process类代码示例

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


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

示例1: createRepo

 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,代码行数:7,代码来源:test_git_submodules.py

示例2: gitConfigUser

 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,代码行数:8,代码来源:test_git_submodules.py

示例3: addSubmoduleToRepo

 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,代码行数:9,代码来源:test_git_submodules.py

示例4: createRepo

 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,代码行数:11,代码来源:test_git.py

示例5: addFileToRepo

 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,代码行数:12,代码来源:test_git_submodules.py

示例6: testUpdateWithoutRevisionPin

 def testUpdateWithoutRevisionPin(self):
     from mr.developer.develop import CmdCheckout
     from mr.developer.develop 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:angelaqiu,项目名称:mafia,代码行数:45,代码来源:test_git.py

示例7: testUpdateWithoutRevisionPin

 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,代码行数:53,代码来源:test_svn.py

示例8: testUpdateWithoutRevisionPin

    def testUpdateWithoutRevisionPin(self):
        from mr.developer.commands import CmdCheckout
        from mr.developer.commands 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:CGTIC,项目名称:Plone_SP,代码行数:52,代码来源:test_mercurial.py

示例9: testUpdateWithRevisionPin

 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,代码行数:45,代码来源:test_svn.py

示例10: testUpdateWithRevisionPin

    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,代码行数:101,代码来源:test_git.py

示例11: testUpdateWithRevisionPin

    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,代码行数:71,代码来源:test_mercurial.py

示例12: testUpdateWithoutRevisionPin

 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,代码行数:36,代码来源:test_svn.py

示例13: createDefaultContent

    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,代码行数:61,代码来源:test_git.py

示例14: testDepthOption

    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,代码行数:97,代码来源:test_git.py

示例15: testUpdateWithRevisionPin

    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,代码行数:92,代码来源:test_mercurial.py


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