Added silent timer support to pyevent hub, upgraded api_test to use actual unit test primitives rather than inventing its own.
This commit is contained in:
@@ -96,7 +96,8 @@ class Hub(BaseHub):
|
|||||||
self.schedule_call_global(0, api.getcurrent().parent.throw, *self.signal_exc_info)
|
self.schedule_call_global(0, api.getcurrent().parent.throw, *self.signal_exc_info)
|
||||||
self.signal_exc_info = None
|
self.signal_exc_info = None
|
||||||
else:
|
else:
|
||||||
traceback.print_exc()
|
if not self.silent_timer_exceptions:
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
def abort(self):
|
def abort(self):
|
||||||
self.schedule_call_global(0, self.greenlet.throw, api.GreenletExit)
|
self.schedule_call_global(0, self.greenlet.throw, api.GreenletExit)
|
||||||
|
@@ -210,12 +210,12 @@ class TestApi(TestCase):
|
|||||||
state.append('finished')
|
state.append('finished')
|
||||||
g = api.spawn(test)
|
g = api.spawn(test)
|
||||||
api.sleep(DELAY/2)
|
api.sleep(DELAY/2)
|
||||||
assert state == ['start'], state
|
self.assertEquals(state, ['start'])
|
||||||
api.kill(g)
|
api.kill(g)
|
||||||
# will not get there, unless switching is explicitly scheduled by kill
|
# will not get there, unless switching is explicitly scheduled by kill
|
||||||
assert state == ['start', 'except'], state
|
self.assertEquals(state,['start', 'except'])
|
||||||
api.sleep(DELAY)
|
api.sleep(DELAY)
|
||||||
assert state == ['start', 'except', 'finished'], state
|
self.assertEquals(state, ['start', 'except', 'finished'])
|
||||||
|
|
||||||
def test_nested_with_timeout(self):
|
def test_nested_with_timeout(self):
|
||||||
def func():
|
def func():
|
||||||
|
Reference in New Issue
Block a user