本文整理汇总了Python中socorro.processor.legacy_processor.LegacyCrashProcessor._analyze_header方法的典型用法代码示例。如果您正苦于以下问题:Python LegacyCrashProcessor._analyze_header方法的具体用法?Python LegacyCrashProcessor._analyze_header怎么用?Python LegacyCrashProcessor._analyze_header使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socorro.processor.legacy_processor.LegacyCrashProcessor
的用法示例。
在下文中一共展示了LegacyCrashProcessor._analyze_header方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_analyze_header
# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _analyze_header [as 别名]
def test_analyze_header(self): # verify fix for Bug 881623 in test one
"""test some of the possibilities in reading the first three lines
from MDSW. This does not provide comprehensive coverage."""
config = setup_config_with_mocks()
config.collect_addon = False
config.collect_crash_process = True
mocked_transform_rules_str = \
'socorro.processor.legacy_processor.TransformRuleSystem'
with mock.patch(mocked_transform_rules_str) as m_transform_class:
m_transform = mock.Mock()
m_transform_class.return_value = m_transform
m_transform.attach_mock(mock.Mock(), 'apply_all_rules')
utc_now_str = 'socorro.processor.legacy_processor.utc_now'
with mock.patch(utc_now_str) as m_utc_now:
m_utc_now.return_value = datetime(2012, 5, 4, 15, 11,
tzinfo=UTC)
leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)
# test one - all ok
def dump_iter1():
lines = [
'OS|Windows NT|6.1.7601 Service Pack 1 ',
'CPU|x86|GenuineIntel family 6 model 42 stepping 7|8',
'Crash|EXCEPTION_ACCESS_VIOLATION_READ|0xffffffffdadadada|0'
]
for a_line in lines:
yield a_line
processor_notes = []
result = leg_proc._analyze_header(
'1fcdec5e-face-404a-8622-babda2130605',
dump_iter1(),
m_utc_now(),
processor_notes
)
ok_(result.success)
eq_(result.os_name, 'Windows NT')
eq_(result.os_version, '6.1.7601 Service Pack 1')
eq_(result.cpu_name, 'x86')
eq_(result.cpu_info, 'GenuineIntel family 6 model 42 stepping 7 | 8')
eq_(result.reason, 'EXCEPTION_ACCESS_VIOLATION_READ')
eq_(result.address, '0xffffffffdadadada')
eq_(result.crashedThread, 0)
# test two - crashed thread missing
def dump_iter2():
lines = [
'OS|Windows NT|6.1.7601 Service Pack 1 ',
'CPU|x86|GenuineIntel family 6 model 42 stepping 7|8',
'Crash|EXCEPTION_ACCESS_VIOLATION_READ|0xffffffffdadadada|'
]
for a_line in lines:
yield a_line
processor_notes = []
result = leg_proc._analyze_header(
'1fcdec5e-face-404a-8622-babda2130605',
dump_iter2(),
m_utc_now(),
processor_notes
)
ok_(result.success)
eq_(result.os_name, 'Windows NT')
eq_(result.os_version, '6.1.7601 Service Pack 1')
eq_(result.cpu_name, 'x86')
eq_(result.cpu_info, 'GenuineIntel family 6 model 42 stepping 7 | 8')
eq_(result.reason, 'EXCEPTION_ACCESS_VIOLATION_READ')
eq_(result.address, '0xffffffffdadadada')
eq_(result.crashedThread, None)
ok_(
'MDSW did not identify the crashing thread' in
processor_notes
)
# test three - no lines
def dump_iter3():
for a_line in []:
yield a_line
processor_notes = []
result = leg_proc._analyze_header(
'1fcdec5e-face-404a-8622-babda2130605',
dump_iter3(),
m_utc_now(),
processor_notes
)
ok_(result.success)
eq_(result.os_name, None)
eq_(result.os_version, None)
eq_(result.cpu_name, None)
eq_(result.cpu_info, None)
eq_(result.reason, None)
eq_(result.address, None)
eq_(result.crashedThread, None)
#.........这里部分代码省略.........