Skip to content

Commit a105925

Browse files
authored
Merge pull request #2579 from sebix/fix-2571
lib/test: show warnings and errors in case of mismatch
2 parents fb15619 + 77c9a31 commit a105925

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ Please refer to the [NEWS](NEWS.md) for a list of changes which have an affect o
125125
- `intelmq.tests.lib.test_pipeline.TestAmqp.test_acknowledge`: Also skip on Python 3.11 and 3.12 besides on 3.8 when running on CI (PR#2542 by Sebastian Wagner).
126126
- Full pytest workflow: Version-independent install of postgres client, for Ubuntu 24.04 (default on GitHub now) test environment compatibility (PR#2557 by Sebastian Wagner).
127127
- Debian package build workflow: Use artifact upload v4 instead of v3 (PR#2565 by Sebastian Wagner).
128+
- `intelmq.lib.test.BotTestCase`: Show the warnings and errors of a bot if the amount does not match the expected number (PR#2578 by Kamil Mankowski/Sebastian Wagner, related to #2571).
128129

129130
### Known issues
130131
This is short list of the most important known issues. The full list can be retrieved from [GitHub](https://github.com/certtools/intelmq/labels/bug?page=2&q=is%3Aopen+label%3Abug).

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# SPDX-FileCopyrightText: 2023 Filip Pokorný
1+
# SPDX-FileCopyrightText: 2023-2025 Filip Pokorný, Sebastian Wagner
22
# SPDX-License-Identifier: AGPL-3.0-or-later
33

4-
.PHONY: coverage docs clean
4+
.PHONY: coverage docs clean test codespell codestyle
55

66
coverage:
77
python -m pytest --cov=intelmq -v

intelmq/lib/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,9 @@ def run_bot(self, iterations: int = 1, error_on_pipeline: bool = False,
386386
self.assertLoglineEqual(-1, "Bot stopped.", "INFO")
387387

388388
allowed_error_count = max(allowed_error_count, self.allowed_error_count)
389-
self.assertLessEqual(len(re.findall(' - ERROR - ', self.loglines_buffer)), allowed_error_count)
389+
self.assertLessEqual(len(re.findall(' - ERROR - ', self.loglines_buffer)), allowed_error_count, "\n".join(re.findall(' - ERROR - [^\n]*', self.loglines_buffer)))
390390
allowed_warning_count = max(allowed_warning_count, self.allowed_warning_count)
391-
self.assertLessEqual(len(re.findall(' - WARNING - ', self.loglines_buffer)), allowed_warning_count)
391+
self.assertLessEqual(len(re.findall(' - WARNING - ', self.loglines_buffer)), allowed_warning_count, "\n".join(re.findall(' - WARNING - [^\n]*', self.loglines_buffer)))
392392
self.assertNotRegexpMatchesLog("CRITICAL")
393393
""" If no error happened (incl. tracebacks) we can check for formatting """
394394
if not self.allowed_error_count:

0 commit comments

Comments
 (0)