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:
Ryan Williams
2010-01-08 12:39:10 -08:00
parent a868b1c857
commit d33bb039e2
2 changed files with 5 additions and 4 deletions

View File

@@ -96,6 +96,7 @@ 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:
if not self.silent_timer_exceptions:
traceback.print_exc() traceback.print_exc()
def abort(self): def abort(self):

View File

@@ -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():