Skip to content

Commit

Permalink
pytest: Add support for pytest-8.2 on Python3.11 (color, verbose)
Browse files Browse the repository at this point in the history
Signed-off-by: Bernhard Kaindl <[email protected]>
  • Loading branch information
bernhardkaindl committed Jun 4, 2024
1 parent 2bc9efe commit fca707e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[pytest]
# By default, show reports for failed tests:
addopts=-rF
# By default, show reports for failed tests, and show the summary: -rF
# By default, also be verbose (needed for self-tests with pytest-8) -vv
# By default, also show the local variables in the traceback: --showlocals
addopts=-rF -vv --showlocals

# imp is only used in a unit test, will be updated to python3 later:
filterwarnings=ignore:the imp module is deprecated
# Enable live logging of the python log output, starting with log level INFO by default:
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/test_filter_xapi_clusterd_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,13 @@ def test_assertion_on_unexpected_token(isolated_bugtool):
# -> Act and assert: Check that the assertion function fails on the unexpected output
# The assertion function should assert on the differing authkey value and the
# diff with the wrongly expected string should be in the assertion error message
#
# pytest-8 adds very fine-grained coloring of the assertion error message
# which makes it harder to match the diff string in the assertion error message.
# Apparently, we cannot disable the coloring for a single assertion, so we can
# only check for the the unexpected token in the assertion:

diff = "{'token': 'REMOVED'} != {'token': 'unexpected token value'}"
diff = "'token': 'unexpected token value'"
check_assert_on_unexpected_differences_in_output(isolated_bugtool, expected, diff)


Expand Down

0 comments on commit fca707e

Please sign in to comment.