Permalink
Browse files

additional verbosity in ExecutionContext

  • Loading branch information...
1 parent 80ed636 commit 85c67d9feaaf7968ecfb250373e03458ebd5b0d7 @evilkost committed Apr 26, 2011
Showing with 15 additions and 3 deletions.
  1. +9 −2 brukva/client.py
  2. +6 −1 tests/server_commands.py
View
@@ -5,6 +5,7 @@
import logging
from collections import Iterable, defaultdict
import weakref
+import traceback
from tornado.ioloop import IOLoop
from tornado.iostream import IOStream
@@ -32,14 +33,20 @@ def _call_callbacks(self, callbacks, value):
def __enter__(self):
return self
- def __exit__(self, type, value, tb):
- if type is None:
+ def __exit__(self, type_, value, tb):
+ if type_ is None:
return True
if self.error_wrapper:
value = self.error_wrapper(value)
+ else:
+ value = value or Exception(
+ 'Strange exception with None value type: %s; tb: %s' %
+ (type_, '\n'.join(traceback.format_tb(tb))
+ ))
if self.is_active:
+ log.error(value, exc_info=(type_, value, tb))
self.ret_call(value)
return True
else:
View
@@ -749,9 +749,14 @@ def on_subscription(msg):
self.assertEqual(msg.body, 1)
self.client2.listen(on_recv)
+ def on_publish(value):
+ self.assertIsNotNone(value)
+
self.client2.subscribe('foo', on_subscription)
self.delayed(0.2, lambda: self.client2.disconnect())
- self.delayed(0.3, self.finish)
+ self.delayed(0.3, lambda: self.client.publish('foo', 'bar', on_publish))
+ self.delayed(0.4, lambda: self.client2.publish('foo', 'bar', on_publish))
+ self.delayed(0.5, self.finish)
self.start()
class AsyncWrapperTestCase(TornadoTestCase):

0 comments on commit 85c67d9

Please sign in to comment.