本文整理汇总了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__()
示例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'))
示例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__()
示例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'))
示例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']))
""")