timer_test: add a few comments

This commit is contained in:
Denis Bilenko
2009-06-17 18:01:50 +07:00
parent b30acf5b31
commit 51be13aaf7

View File

@@ -25,6 +25,7 @@ from eventlet import api, timer
class TestTimer(TestCase): class TestTimer(TestCase):
mode = 'static' mode = 'static'
def test_copy(self): def test_copy(self):
t = timer.Timer(0, lambda: None) t = timer.Timer(0, lambda: None)
t2 = t.copy() t2 = t.copy()
@@ -45,7 +46,6 @@ class TestTimer(TestCase):
def test_schedule(self): def test_schedule(self):
hub = api.get_hub() hub = api.get_hub()
## r = hub.runloop
# clean up the runloop, preventing side effects from previous tests # clean up the runloop, preventing side effects from previous tests
# on this thread # on this thread
if hub.running: if hub.running:
@@ -54,6 +54,10 @@ class TestTimer(TestCase):
called = [] called = []
#t = timer.Timer(0, lambda: (called.append(True), hub.abort())) #t = timer.Timer(0, lambda: (called.append(True), hub.abort()))
#t.schedule() #t.schedule()
# let's have a timer somewhere in the future; make sure abort() still works
# (for libevent, its dispatcher() does not exit if there is something scheduled)
# XXX libevent handles this, other hubs do not
#api.get_hub().schedule_call_global(10000, lambda: (called.append(True), hub.abort()))
api.get_hub().schedule_call_global(0, lambda: (called.append(True), hub.abort())) api.get_hub().schedule_call_global(0, lambda: (called.append(True), hub.abort()))
hub.default_sleep = lambda: 0.0 hub.default_sleep = lambda: 0.0
hub.switch() hub.switch()