本文整理汇总了Python中tests.mr_two_step_job.MRTwoStepJob.run_job方法的典型用法代码示例。如果您正苦于以下问题:Python MRTwoStepJob.run_job方法的具体用法?Python MRTwoStepJob.run_job怎么用?Python MRTwoStepJob.run_job使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.mr_two_step_job.MRTwoStepJob
的用法示例。
在下文中一共展示了MRTwoStepJob.run_job方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_python_dash_v_as_python_bin
# 需要导入模块: from tests.mr_two_step_job import MRTwoStepJob [as 别名]
# 或者: from tests.mr_two_step_job.MRTwoStepJob import run_job [as 别名]
def test_python_dash_v_as_python_bin(self):
python_cmd = cmd_line([sys.executable or 'python', '-v'])
mr_job = MRTwoStepJob(['--python-bin', python_cmd, '--no-conf'])
mr_job.sandbox(stdin=['bar\n'])
with no_handlers_for_logger():
mr_job.run_job()
# expect debugging messages in stderr
assert_in('import mrjob', mr_job.stderr.getvalue())
assert_in('#', mr_job.stderr.getvalue())
# should still get expected results
assert_equal(sorted(mr_job.parse_output()), [(1, None), (1, 'bar')])
示例2: test_python_dash_v_as_python_bin
# 需要导入模块: from tests.mr_two_step_job import MRTwoStepJob [as 别名]
# 或者: from tests.mr_two_step_job.MRTwoStepJob import run_job [as 别名]
def test_python_dash_v_as_python_bin(self):
python_cmd = cmd_line([sys.executable or 'python', '-v'])
mr_job = MRTwoStepJob(['--python-bin', python_cmd, '--no-conf',
'-r', 'local'])
mr_job.sandbox(stdin=['bar\n'])
with no_handlers_for_logger():
mr_job.run_job()
# expect debugging messages in stderr
self.assertIn('import mrjob', mr_job.stderr.getvalue())
self.assertIn('#', mr_job.stderr.getvalue())
# should still get expected results
self.assertItemsEqual(mr_job.stdout.getvalue().splitlines(),
['1\tnull', '1\t"bar"'])
示例3: test_python_dash_v_as_python_bin
# 需要导入模块: from tests.mr_two_step_job import MRTwoStepJob [as 别名]
# 或者: from tests.mr_two_step_job.MRTwoStepJob import run_job [as 别名]
def test_python_dash_v_as_python_bin(self):
python_cmd = cmd_line([sys.executable or "python", "-v"])
mr_job = MRTwoStepJob(["--python-bin", python_cmd, "--no-conf", "-r", "local"])
mr_job.sandbox(stdin=[b"bar\n"])
with no_handlers_for_logger():
mr_job.run_job()
# expect debugging messages in stderr.
stderr = mr_job.stderr.getvalue()
# stderr is huge, so don't use assertIn()
self.assertTrue(b"import mrjob" in stderr or b"import 'mrjob'" in stderr) # Python 2 # Python 3
self.assertTrue(b"#" in stderr)
# should still get expected results
self.assertEqual(sorted(mr_job.stdout.getvalue().splitlines()), sorted([b"1\tnull", b'1\t"bar"']))
示例4: test_python_dash_v_as_python_bin
# 需要导入模块: from tests.mr_two_step_job import MRTwoStepJob [as 别名]
# 或者: from tests.mr_two_step_job.MRTwoStepJob import run_job [as 别名]
def test_python_dash_v_as_python_bin(self):
python_cmd = cmd_line([sys.executable or 'python', '-v'])
mr_job = MRTwoStepJob(['--python-bin', python_cmd, '--no-conf',
'-r', 'local'])
mr_job.sandbox(stdin=[b'bar\n'])
with no_handlers_for_logger():
mr_job.run_job()
# expect debugging messages in stderr.
stderr = mr_job.stderr.getvalue()
# stderr is huge, so don't use assertIn()
self.assertTrue(b'import mrjob' in stderr or # Python 2
b"import 'mrjob'" in stderr) # Python 3
self.assertTrue(b'#' in stderr)
# should still get expected results
self.assertEqual(sorted(mr_job.stdout.getvalue().splitlines()),
sorted([b'1\tnull', b'1\t"bar"']))