本文整理汇总了Python中tests.mr_os_walk_job.MROSWalkJob.parse_output_line方法的典型用法代码示例。如果您正苦于以下问题:Python MROSWalkJob.parse_output_line方法的具体用法?Python MROSWalkJob.parse_output_line怎么用?Python MROSWalkJob.parse_output_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.mr_os_walk_job.MROSWalkJob
的用法示例。
在下文中一共展示了MROSWalkJob.parse_output_line方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_stdin_bypasses_wrapper_script
# 需要导入模块: from tests.mr_os_walk_job import MROSWalkJob [as 别名]
# 或者: from tests.mr_os_walk_job.MROSWalkJob import parse_output_line [as 别名]
def test_stdin_bypasses_wrapper_script(self):
job = MROSWalkJob([
'-r', 'local',
'--setup', 'cat > stdin.txt',
])
job.sandbox(stdin=BytesIO(b'some input\n'))
# local mode doesn't currently pipe input into stdin
# (see issue #567), so this test would hang if it failed
def alarm_handler(*args, **kwargs):
raise Exception('Setup script stalled on stdin')
try:
self._old_alarm_handler = signal.signal(
signal.SIGALRM, alarm_handler)
signal.alarm(10)
with job.make_runner() as r:
r.run()
path_to_size = dict(job.parse_output_line(line)
for line in r.stream_output())
self.assertEqual(path_to_size.get('./stdin.txt'), 0)
# input gets passed through by identity mapper
self.assertEqual(path_to_size.get(None), 'some input')
finally:
signal.alarm(0)
signal.signal(signal.SIGALRM, self._old_alarm_handler)
示例2: test_setup_command
# 需要导入模块: from tests.mr_os_walk_job import MROSWalkJob [as 别名]
# 或者: from tests.mr_os_walk_job.MROSWalkJob import parse_output_line [as 别名]
def test_setup_command(self):
job = MROSWalkJob(["-r", "local", "--setup", "touch bar"])
job.sandbox()
with job.make_runner() as r:
r.run()
path_to_size = dict(job.parse_output_line(line) for line in r.stream_output())
self.assertIn("./bar", path_to_size)
示例3: test_setup_script
# 需要导入模块: from tests.mr_os_walk_job import MROSWalkJob [as 别名]
# 或者: from tests.mr_os_walk_job.MROSWalkJob import parse_output_line [as 别名]
def test_setup_script(self):
job = MROSWalkJob(["-r", "local", "--setup", self.foo_sh + "#"])
job.sandbox()
with job.make_runner() as r:
r.run()
path_to_size = dict(job.parse_output_line(line) for line in r.stream_output())
self.assertEqual(path_to_size.get("./foo.sh"), self.foo_sh_size)
self.assertIn("./foo.sh-made-this", path_to_size)
示例4: test_file_upload
# 需要导入模块: from tests.mr_os_walk_job import MROSWalkJob [as 别名]
# 或者: from tests.mr_os_walk_job.MROSWalkJob import parse_output_line [as 别名]
def test_file_upload(self):
job = MROSWalkJob(["-r", "local", "--file", self.foo_sh, "--file", self.foo_sh + "#bar.sh"])
job.sandbox()
with job.make_runner() as r:
r.run()
path_to_size = dict(job.parse_output_line(line) for line in r.stream_output())
self.assertEqual(path_to_size.get("./foo.sh"), self.foo_sh_size)
self.assertEqual(path_to_size.get("./bar.sh"), self.foo_sh_size)
示例5: test_archive_upload
# 需要导入模块: from tests.mr_os_walk_job import MROSWalkJob [as 别名]
# 或者: from tests.mr_os_walk_job.MROSWalkJob import parse_output_line [as 别名]
def test_archive_upload(self):
job = MROSWalkJob(["-r", "local", "--archive", self.foo_tar_gz, "--archive", self.foo_tar_gz + "#foo"])
job.sandbox()
with job.make_runner() as r:
r.run()
path_to_size = dict(job.parse_output_line(line) for line in r.stream_output())
self.assertEqual(path_to_size.get("./foo.tar.gz/foo.py"), self.foo_py_size)
self.assertEqual(path_to_size.get("./foo/foo.py"), self.foo_py_size)
示例6: test_python_archive
# 需要导入模块: from tests.mr_os_walk_job import MROSWalkJob [as 别名]
# 或者: from tests.mr_os_walk_job.MROSWalkJob import parse_output_line [as 别名]
def test_python_archive(self):
job = MROSWalkJob(["-r", "local", "--setup", "export PYTHONPATH=%s#/:$PYTHONPATH" % self.foo_tar_gz])
job.sandbox()
with job.make_runner() as r:
r.run()
path_to_size = dict(job.parse_output_line(line) for line in r.stream_output())
# foo.py should be there, and getsize() should be patched to return
# double the number of bytes
self.assertEqual(path_to_size.get("./foo.tar.gz/foo.py"), self.foo_py_size * 2)
示例7: test_setup_command
# 需要导入模块: from tests.mr_os_walk_job import MROSWalkJob [as 别名]
# 或者: from tests.mr_os_walk_job.MROSWalkJob import parse_output_line [as 别名]
def test_setup_command(self):
job = MROSWalkJob(
['-r', 'local',
'--setup', 'touch bar'])
job.sandbox()
with job.make_runner() as r:
r.run()
path_to_size = dict(job.parse_output_line(line)
for line in r.stream_output())
self.assertIn('./bar', path_to_size)
示例8: test_setup_script
# 需要导入模块: from tests.mr_os_walk_job import MROSWalkJob [as 别名]
# 或者: from tests.mr_os_walk_job.MROSWalkJob import parse_output_line [as 别名]
def test_setup_script(self):
job = MROSWalkJob(
['-r', 'local',
'--setup', self.foo_sh + '#'])
job.sandbox()
with job.make_runner() as r:
r.run()
path_to_size = dict(job.parse_output_line(line)
for line in r.stream_output())
self.assertEqual(path_to_size.get('./foo.sh'), self.foo_sh_size)
self.assertIn('./foo.sh-made-this', path_to_size)
示例9: test_file_upload
# 需要导入模块: from tests.mr_os_walk_job import MROSWalkJob [as 别名]
# 或者: from tests.mr_os_walk_job.MROSWalkJob import parse_output_line [as 别名]
def test_file_upload(self):
job = MROSWalkJob(['-r', 'local',
'--file', self.foo_sh,
'--file', self.foo_sh + '#bar.sh',
])
job.sandbox()
with job.make_runner() as r:
r.run()
path_to_size = dict(job.parse_output_line(line)
for line in r.stream_output())
self.assertEqual(path_to_size.get('./foo.sh'), self.foo_sh_size)
self.assertEqual(path_to_size.get('./bar.sh'), self.foo_sh_size)
示例10: test_deprecated_python_archive_option
# 需要导入模块: from tests.mr_os_walk_job import MROSWalkJob [as 别名]
# 或者: from tests.mr_os_walk_job.MROSWalkJob import parse_output_line [as 别名]
def test_deprecated_python_archive_option(self):
job = MROSWalkJob(
['-r', 'local',
'--python-archive', self.foo_tar_gz])
job.sandbox()
with job.make_runner() as r:
r.run()
path_to_size = dict(job.parse_output_line(line)
for line in r.stream_output())
# foo.py should be there, and getsize() should be patched to return
# double the number of bytes
self.assertEqual(path_to_size.get('./foo.tar.gz/foo.py'),
self.foo_py_size * 2)
示例11: test_archive_upload
# 需要导入模块: from tests.mr_os_walk_job import MROSWalkJob [as 别名]
# 或者: from tests.mr_os_walk_job.MROSWalkJob import parse_output_line [as 别名]
def test_archive_upload(self):
job = MROSWalkJob(['--runner=local', '--no-bootstrap-mrjob',
'--archive', self.foo_tar_gz,
'--archive', self.foo_tar_gz + '#foo',
])
job.sandbox()
with job.make_runner() as r:
r.run()
path_to_size = dict(job.parse_output_line(line)
for line in r.stream_output())
self.assertEqual(path_to_size.get('./foo.tar.gz/foo.py'),
self.foo_py_size)
self.assertEqual(path_to_size.get('./foo/foo.py'),
self.foo_py_size)