From 2511c3cea47de42e08fe3ef8e45e88d8914fcd04 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 3 Jul 2020 17:55:05 +0200 Subject: ci: Write problem matchers for Python/pytest exceptions --- .github/workflows/ci.yml | 4 ++++ scripts/dev/ci/problemmatchers.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc684e47d..47be2944e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,6 +65,8 @@ jobs: options: --privileged --tty steps: - uses: actions/checkout@v2 + - name: Set up problem matchers + run: "python3 scripts/dev/ci/problemmatchers.py py38" - run: tox -e py38 tests: @@ -139,6 +141,8 @@ jobs: if: "endsWith(matrix.python, '-dev')" with: python-version: "${{ matrix.python }}" + - name: Set up problem matchers + run: "python3 scripts/dev/ci/problemmatchers.py ${{ matrix.testenv }}" - name: Install apt dependencies run: sudo apt-get install --no-install-recommends libyaml-dev libegl1-mesa libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 if: "startsWith(matrix.os, 'ubuntu-')" diff --git a/scripts/dev/ci/problemmatchers.py b/scripts/dev/ci/problemmatchers.py index 13f960c31..a10077282 100644 --- a/scripts/dev/ci/problemmatchers.py +++ b/scripts/dev/ci/problemmatchers.py @@ -134,6 +134,38 @@ MATCHERS = { ], }, ], + + "tests": [ + { + # BDD tests / normal Python exceptions + "severity": "error", + "pattern": [ + { + "regexp": r'^E?\s*File "(.*)", line (\d+), in .*$', + "file": 1, + "line": 2, + }, + { + "regexp": r"E?\s*\w+Error: (.*)", + "message": 1, + } + ], + }, + { + # pytest stacktraces + # qutebrowser/utils/utils.py:773: AssertionError + # tests/unit/utils/test_utils.py:887: + "severity": "error", + "pattern": [ + { + "regexp": r'^([^ ]*):(\d+): ?(.*)', + "file": 1, + "line": 2, + "message": 3, + } + ], + }, + ] } @@ -152,6 +184,9 @@ def add_matcher(output_dir, testenv, data): def main(): testenv = sys.argv[1] + if testenv.startswith('py3'): + testenv = 'tests' + if testenv not in MATCHERS: return -- cgit v1.2.3-54-g00ecf