Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-loguru for openSUSE:Factory 
checked in at 2021-02-19 23:44:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-loguru (Old)
 and      /work/SRC/openSUSE:Factory/.python-loguru.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-loguru"

Fri Feb 19 23:44:21 2021 rev:5 rq:873588 version:0.5.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-loguru/python-loguru.changes      
2021-02-09 21:17:07.262832255 +0100
+++ /work/SRC/openSUSE:Factory/.python-loguru.new.28504/python-loguru.changes   
2021-02-19 23:45:24.275371585 +0100
@@ -1,0 +2,5 @@
+Fri Feb 19 01:51:00 UTC 2021 - John Vandenberg <[email protected]>
+
+- Add pytest-6.2-excepthooks.patch for compatibility with pytest 6.2
+
+-------------------------------------------------------------------

New:
----
  pytest-6.2-excepthooks.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-loguru.spec ++++++
--- /var/tmp/diff_new_pack.w1N50i/_old  2021-02-19 23:45:24.779372078 +0100
+++ /var/tmp/diff_new_pack.w1N50i/_new  2021-02-19 23:45:24.779372078 +0100
@@ -26,6 +26,7 @@
 Group:          Development/Languages/Python
 URL:            https://github.com/Delgan/loguru
 Source:         
https://files.pythonhosted.org/packages/source/l/loguru/loguru-%{version}.tar.gz
+Patch0:         
https://github.com/Delgan/loguru/commit/31cf758ee9d22dbfa125f38153782fe20ac9dce5.patch#/pytest-6.2-excepthooks.patch
 BuildRequires:  %{python_module colorama}
 BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module setuptools}
@@ -46,6 +47,7 @@
 
 %prep
 %setup -q -n loguru-%{version}
+%patch0 -p1
 
 %build
 %python_build

++++++ pytest-6.2-excepthooks.patch ++++++
>From 31cf758ee9d22dbfa125f38153782fe20ac9dce5 Mon Sep 17 00:00:00 2001
From: Delgan <[email protected]>
Date: Sat, 19 Dec 2020 16:29:07 +0100
Subject: [PATCH] Fix failing tests due to new "excepthook" in threads

---
 tests/test_add_option_enqueue.py | 44 +++++++++++++++++++++++++-------
 1 file changed, 35 insertions(+), 9 deletions(-)

diff --git a/tests/test_add_option_enqueue.py b/tests/test_add_option_enqueue.py
index 50e1843..4b7c891 100644
--- a/tests/test_add_option_enqueue.py
+++ b/tests/test_add_option_enqueue.py
@@ -4,6 +4,9 @@
 import re
 import sys
 import pickle
+import contextlib
+import threading
+import traceback
 
 
 class NotPicklable:
@@ -29,6 +32,27 @@ def write(self, message):
         print(message, end="")
 
 
[email protected]
+def default_threading_excepthook():
+    if not hasattr(threading, "excepthook"):
+        yield
+        return
+
+    # Pytest added "PytestUnhandledThreadExceptionWarning", we need to
+    # remove it temporarily for somes tests checking exceptions in threads.
+
+    def excepthook(args):
+        print("Exception in thread:", file=sys.stderr, flush=True)
+        traceback.print_exception(
+            args.exc_type, args.exc_value, args.exc_traceback, file=sys.stderr
+        )
+
+    old_excepthook = threading.excepthook
+    threading.excepthook = excepthook
+    yield
+    threading.excepthook = old_excepthook
+
+
 def test_enqueue():
     x = []
 
@@ -139,10 +163,11 @@ def test_not_caught_exception_queue_put(writer, capsys):
 def test_not_caught_exception_queue_get(writer, capsys):
     logger.add(writer, enqueue=True, catch=False, format="{message}")
 
-    logger.info("It's fine")
-    logger.bind(broken=NotUnpicklable()).info("Bye bye...")
-    logger.info("It's not fine")
-    logger.remove()
+    with default_threading_excepthook():
+        logger.info("It's fine")
+        logger.bind(broken=NotUnpicklable()).info("Bye bye...")
+        logger.info("It's not fine")
+        logger.remove()
 
     out, err = capsys.readouterr()
     lines = err.strip().splitlines()
@@ -152,13 +177,14 @@ def test_not_caught_exception_queue_get(writer, capsys):
     assert lines[-1].endswith("UnpicklingError: You shall not de-serialize 
me!")
 
 
-def test_not_caught_exception_sink_write(capsys):
+def test_not_caught_exception_sink_write(monkeypatch, capsys):
     logger.add(NotWritable(), enqueue=True, catch=False, format="{message}")
 
-    logger.info("It's fine")
-    logger.bind(fail=True).info("Bye bye...")
-    logger.info("It's not fine")
-    logger.remove()
+    with default_threading_excepthook():
+        logger.info("It's fine")
+        logger.bind(fail=True).info("Bye bye...")
+        logger.info("It's not fine")
+        logger.remove()
 
     out, err = capsys.readouterr()
     lines = err.strip().splitlines()

Reply via email to