diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-03-07 11:57:01 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-03-07 11:57:01 +0000 |
commit | b3fef92e618039dc93153a93176184a49606c74a (patch) | |
tree | ad9ab32cccd1125450feb872dd493ae07b6f4ffd /dev-python/loguru/files/0.6.0-py311-fix.patch | |
parent | 32f67cc4163d5c6e094345e920ada52367df5f5f (diff) |
gentoo auto-resync : 07:03:2023 - 11:57:00
Diffstat (limited to 'dev-python/loguru/files/0.6.0-py311-fix.patch')
-rw-r--r-- | dev-python/loguru/files/0.6.0-py311-fix.patch | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/dev-python/loguru/files/0.6.0-py311-fix.patch b/dev-python/loguru/files/0.6.0-py311-fix.patch new file mode 100644 index 000000000000..a7d29b911fac --- /dev/null +++ b/dev-python/loguru/files/0.6.0-py311-fix.patch @@ -0,0 +1,68 @@ +Fix failing tests on Python 3.11 (#654) + +Issue: https://github.com/Delgan/loguru/issues/654 +Commit: https://github.com/Delgan/loguru/commit/5b77724ca75aa8f4b1c8866e0b786c3cbe30ca99 + +diff --git a/tests/test_filesink_rotation.py b/tests/test_filesink_rotation.py +index bdf75a3..fb80b69 100644 +--- a/tests/test_filesink_rotation.py ++++ b/tests/test_filesink_rotation.py +@@ -49,8 +49,8 @@ def monkeypatch_filesystem(monkeypatch): + return self._timestamp + return getattr(self._wrapped, name) + +- def patched_stat(filepath): +- stat = __stat__(filepath) ++ def patched_stat(filepath, *args, **kwargs): ++ stat = __stat__(filepath, *args, **kwargs) + wrapped = StatWrapper(stat, filesystem.get(os.path.abspath(filepath))) + return wrapped + +diff --git a/tests/test_interception.py b/tests/test_interception.py +index a05802a..2f570b9 100644 +--- a/tests/test_interception.py ++++ b/tests/test_interception.py +@@ -1,4 +1,5 @@ + import logging ++import sys + + from loguru import logger + +@@ -7,15 +8,15 @@ from .conftest import make_logging_logger + + class InterceptHandler(logging.Handler): + def emit(self, record): +- # Get corresponding Loguru level if it exists ++ # Get corresponding Loguru level if it exists. + try: + level = logger.level(record.levelname).name + except ValueError: + level = record.levelno + +- # Find caller from where originated the logged message +- frame, depth = logging.currentframe(), 2 +- while frame.f_code.co_filename == logging.__file__: ++ # Find caller from where originated the logged message. ++ frame, depth = sys._getframe(6), 6 ++ while frame and frame.f_code.co_filename == logging.__file__: + frame = frame.f_back + depth += 1 + +@@ -30,7 +31,7 @@ def test_formatting(writer): + + expected = ( + "tests.test_interception - test_interception.py - test_formatting - DEBUG - " +- "10 - 38 - test_interception - This is the message\n" ++ "10 - 39 - test_interception - This is the message\n" + ) + + with make_logging_logger("tests", InterceptHandler()) as logging_logger: +@@ -157,4 +158,4 @@ def test_using_logging_function(writer): + logging.warning("ABC") + + result = writer.read() +- assert result == "test_using_logging_function 157 test_interception test_interception.py ABC\n" ++ assert result == "test_using_logging_function 158 test_interception test_interception.py ABC\n" +-- +2.39.2 + |