From fc72fd4e2ca1ba55d7afd16f2bc4bc1205f14b89 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Thu, 19 Dec 2024 17:35:46 +0300 Subject: [PATCH] Fix tests --- tests/logs/test_rp_logger.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/logs/test_rp_logger.py b/tests/logs/test_rp_logger.py index d43d6ba..f8f593c 100644 --- a/tests/logs/test_rp_logger.py +++ b/tests/logs/test_rp_logger.py @@ -80,6 +80,11 @@ def test_stacklevel_record_make(logger_handler): else: logger.error("test_log", exc_info=RuntimeError("test"), stack_info=inspect.stack(), stacklevel=2) record = verify_record(logger_handler) - assert record.stack_info.endswith( - 'logger.error("test_log", exc_info=RuntimeError("test"), stack_info=inspect.stack(), stacklevel=1)') + if sys.version_info < (3, 11): + assert record.stack_info.endswith( + 'logger.error("test_log", exc_info=RuntimeError("test"), stack_info=inspect.stack(), stacklevel=1)') + else: + assert record.stack_info.endswith( + 'logger.error("test_log", exc_info=RuntimeError("test"), stack_info=inspect.stack(), stacklevel=2)') + assert record.pathname == __file__