[pygobject] tests: don't assume anything about sys.excepthook

commit d9ddad7bcac86d37a9010c8cd529a0e6ca1a9f48
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Fri Aug 17 23:35:33 2018 +0200

    tests: don't assume anything about sys.excepthook
    On Ubuntu (at least the 18.10 dev version) sys.excepthook is some apport_excepthook
    object and not the default Python one. Our pytest extension was checking
    that sys.excepthook is the default which made every test fail as a result.
    Be less strict and don't assume anything about sys.excepthook instead.

 tests/conftest.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index 4d0cc6b0..820210ce 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -16,18 +16,16 @@ def pytest_runtest_call(item):
     like any signal handler, vfuncs tc)
-    assert sys.excepthook is sys.__excepthook__
     exceptions = []
     def on_hook(type_, value, tback):
         exceptions.append((type_, value, tback))
+    orig_excepthook = sys.excepthook
     sys.excepthook = on_hook
-        assert sys.excepthook in (on_hook, sys.__excepthook__)
-        sys.excepthook = sys.__excepthook__
+        sys.excepthook = orig_excepthook
         if exceptions:

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]