本文整理汇总了Python中jarn.mkrelease.process.Process.popen方法的典型用法代码示例。如果您正苦于以下问题:Python Process.popen方法的具体用法?Python Process.popen怎么用?Python Process.popen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jarn.mkrelease.process.Process
的用法示例。
在下文中一共展示了Process.popen方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_env
# 需要导入模块: from jarn.mkrelease.process import Process [as 别名]
# 或者: from jarn.mkrelease.process.Process import popen [as 别名]
def test_env(self):
env = os.environ.copy()
env['HELLO'] = 'Hello world'
process = Process(quiet=True, env=env)
rc, lines = process.popen('echo ${HELLO}')
self.assertEqual(rc, 0)
self.assertEqual(lines, ['Hello world'])
示例2: _fake_clone
# 需要导入模块: from jarn.mkrelease.process import Process [as 别名]
# 或者: from jarn.mkrelease.process.Process import popen [as 别名]
def _fake_clone(self):
# Fake a checkout, the real thing is too expensive
process = Process(quiet=True)
source = self._fake_source
package = join(dirname(__file__), 'tests', source)
archive = zipfile.ZipFile(package, 'r')
archive.extractall()
os.rename(source[:-4], 'testclone')
self.dirstack.push('testclone')
if self.scm.version_info[:2] >= (1, 7):
url = process.popen('svn info')[1][2][5:]
else:
url = process.popen('svn info')[1][1][5:]
process.system('svn switch --relocate %s file://%s/trunk' % (url, self.packagedir))
self.dirstack.pop()
self.clonedir = join(self.tempdir, 'testclone')
示例3: testUpdateWithRevisionPin
# 需要导入模块: from jarn.mkrelease.process import Process [as 别名]
# 或者: from jarn.mkrelease.process.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 {0}".format(repository))
assert rc == 0
checkout = os.path.join(self.tempdir, 'checkout')
rc, lines = process.popen(
"svn checkout file://{0} {1}".format(repository, checkout),
echo=False)
assert rc == 0
foo = os.path.join(checkout, 'foo')
self.mkfile(foo, 'foo')
rc, lines = process.popen(
"svn add {0}".format(foo),
echo=False)
assert rc == 0
rc, lines = process.popen(
"svn commit {0} -m foo".format(foo),
echo=False)
assert rc == 0
bar = os.path.join(checkout, 'bar')
self.mkfile(bar, 'bar')
rc, lines = process.popen(
"svn add {0}".format(bar),
echo=False)
assert rc == 0
rc, lines = process.popen(
"svn commit {0} -m bar".format(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://{0}@1'.format(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'))
示例4: test_bad_cmd
# 需要导入模块: from jarn.mkrelease.process import Process [as 别名]
# 或者: from jarn.mkrelease.process.Process import popen [as 别名]
def test_bad_cmd(self):
process = Process()
rc, lines = process.popen('$ "Hello world"')
self.assertEqual(rc, 127)
self.assertEqual(lines, [])
示例5: test_echo2
# 需要导入模块: from jarn.mkrelease.process import Process [as 别名]
# 或者: from jarn.mkrelease.process.Process import popen [as 别名]
def test_echo2(self):
process = Process()
rc, lines = process.popen('$ "Hello world"', echo2=False)
self.assertEqual(rc, 127)
self.assertEqual(lines, [])
示例6: test_echo
# 需要导入模块: from jarn.mkrelease.process import Process [as 别名]
# 或者: from jarn.mkrelease.process.Process import popen [as 别名]
def test_echo(self):
process = Process()
rc, lines = process.popen('echo "Hello world"', echo=False)
self.assertEqual(rc, 0)
self.assertEqual(lines, ['Hello world'])
示例7: test_quiet
# 需要导入模块: from jarn.mkrelease.process import Process [as 别名]
# 或者: from jarn.mkrelease.process.Process import popen [as 别名]
def test_quiet(self):
process = Process(quiet=True)
rc, lines = process.popen('echo "Hello world"')
self.assertEqual(rc, 0)
self.assertEqual(lines, ['Hello world'])
示例8: test_simple
# 需要导入模块: from jarn.mkrelease.process import Process [as 别名]
# 或者: from jarn.mkrelease.process.Process import popen [as 别名]
def test_simple(self):
process = Process()
rc, lines = process.popen('echo "Hello world"')
self.assertEqual(rc, 0)
self.assertEqual(lines, ['Hello world'])