summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2016-12-05 20:50:29 +0100
committerArmin Ronacher <armin.ronacher@active-4.com>2016-12-05 20:50:29 +0100
commitfd01cfb78923b9abc166f4cdbcf259f432ac8f11 (patch)
tree584d256b446a806373f3bdf2362673210e81a247
parent1a99705938e94ad41d7e0d2ae5bb9faba9b3bc7c (diff)
downloadraven-feature/notty.tar.gz
Added test for sys hook behaviorfeature/notty
-rw-r--r--tests/base/tests.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/base/tests.py b/tests/base/tests.py
index 1ef4402..f2e5485 100644
--- a/tests/base/tests.py
+++ b/tests/base/tests.py
@@ -585,3 +585,26 @@ class ClientTest(TestCase):
Client()
finally:
sys.argv = argv
+
+ def test_sys_hook(self):
+ client = TempStoreClient(install_sys_hook=True)
+ try:
+ 1 / 0
+ except Exception:
+ sys.excepthook(*sys.exc_info())
+
+ event = client.events.pop(0)
+ exc = event['exception']['values'][-1]
+ assert exc['type'] == 'ZeroDivisionError'
+ assert not client.events
+
+ sys.stdin.isatty = lambda: True
+ try:
+ try:
+ 1 / 0
+ except Exception:
+ sys.excepthook(*sys.exc_info())
+
+ assert not client.events
+ finally:
+ del sys.stdin.isatty