Update pytest summary problem matcher for colored output

We think that at some point pytest added color codes to the summary
output which broke these matcher regex. It looks like there is an issue
about stripping color codes here: https://github.com/actions/runner/issues/2341

I've added wildcard (or no-space) elements instead of trying to match
the color codes exactly (eg `\033\[31m` etc) because 1) that's not very
readable 2) I was having trouble getting that to work with egrep.

The goal is to match the target strings but not to match then later in
the line as part of a test log or whatever. For the '= short test
summary =' that should be pretty unique. For the ERROR|FAILED I reckon
that could be a bit more common. I'm just matching with any mount of
non-space characters because I reckon a space will crop up pretty early
in any line where ERROR isn't the first work.

I think this new matching will only apply to new or rebased PRs after it
is landed.

ref: https://github.com/qutebrowser/qutebrowser/issues/5390#issuecomment-1817503702
This commit is contained in:
toofar 2023-11-19 11:47:05 +13:00
parent c13089b64b
commit 27c5cc8cae
1 changed files with 6 additions and 2 deletions

View File

@ -160,13 +160,17 @@ MATCHERS = {
"tests": [
{
# pytest test summary output
# Examples (with ANSI color codes around FAILED|ERROR and the
# function name):
# FAILED tests/end2end/features/test_keyinput_bdd.py::test_fakekey_sending_special_key_to_the_website - end2end.fixtures.testprocess.WaitForTimeout: Timed out after 15000ms waiting for {'category': 'js', 'message': '[*] key press: 27'}.
# ERROR tests/end2end/test_insert_mode.py::test_insert_mode[100-textarea.html-qute-textarea-clipboard-qutebrowser] - Failed: Logged unexpected errors:
"severity": "error",
"pattern": [
{
"regexp": r'^=+ short test summary info =+$',
"regexp": r'^.*=== short test summary info ===.*$',
},
{
"regexp": r"^((ERROR|FAILED) .*)",
"regexp": r"^[^ ]*((ERROR|FAILED)[^ ]* .*)$",
"message": 1,
"loop": True,
}