From e3f1949f570a2e47759bcb99c3d5d31d53cad448 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 1 May 2016 21:42:44 +0200 Subject: [PATCH] bdd: Fix parsing of logged python warnings --- tests/integration/quteprocess.py | 2 +- tests/integration/test_quteprocess.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/integration/quteprocess.py b/tests/integration/quteprocess.py index f3f3d0087..d919d9245 100644 --- a/tests/integration/quteprocess.py +++ b/tests/integration/quteprocess.py @@ -69,7 +69,7 @@ class LogLine(testprocess.Line): LOG_RE = re.compile(r""" (?P\d\d:\d\d:\d\d) \ (?PVDEBUG|DEBUG|INFO|WARNING|ERROR) - \ +(?P\w+) + \ +(?P[\w.]+) \ +(?P(\w+|Unknown\ module)): (?P[^"][^:]*|"[^"]+"): (?P\d+) diff --git a/tests/integration/test_quteprocess.py b/tests/integration/test_quteprocess.py index 5110324ef..3b136aa3a 100644 --- a/tests/integration/test_quteprocess.py +++ b/tests/integration/test_quteprocess.py @@ -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():