bdd: Fix parsing of logged python warnings

This commit is contained in:
Florian Bruhin 2016-05-01 21:42:44 +02:00
parent dc1b0920ab
commit e3f1949f57
2 changed files with 10 additions and 2 deletions

View File

@ -69,7 +69,7 @@ class LogLine(testprocess.Line):
LOG_RE = re.compile(r"""
(?P<timestamp>\d\d:\d\d:\d\d)
\ (?P<loglevel>VDEBUG|DEBUG|INFO|WARNING|ERROR)
\ +(?P<category>\w+)
\ +(?P<category>[\w.]+)
\ +(?P<module>(\w+|Unknown\ module)):
(?P<function>[^"][^:]*|"[^"]+"):
(?P<line>\d+)

View File

@ -146,8 +146,16 @@ def test_quteprocess_quitting(qtbot, quteproc_process):
'00:00:00 DEBUG foo foo:foo:0 [2s ago] test',
{'prefix': '2s ago', 'message': 'test'}
),
(
# ResourceWarning
"00:00:00 WARNING py.warnings app:qt_mainloop:121 "
".../app.py:121: ResourceWarning: unclosed file <_io.TextIOWrapper "
"name=18 mode='r' encoding='UTF-8'>",
{'category': 'py.warnings'}
),
], ids=['normal', 'vdebug', 'unknown module', 'expected message',
'weird Qt location', 'QXcbXSettings', '2s ago marker'])
'weird Qt location', 'QXcbXSettings', '2s ago marker',
'resourcewarning'])
def test_log_line_parse(data, attrs):
line = quteprocess.LogLine(data)
for name, expected in attrs.items():