coros_test.py: kill trailing whitespace
This commit is contained in:
@@ -75,7 +75,7 @@ class TestEvent(tests.TestCase):
|
|||||||
# def cancel_event():
|
# def cancel_event():
|
||||||
# evt.cancel(current)
|
# evt.cancel(current)
|
||||||
# api.spawn(cancel_event)
|
# api.spawn(cancel_event)
|
||||||
#
|
#
|
||||||
# self.assertRaises(coros.Cancelled, evt.wait)
|
# self.assertRaises(coros.Cancelled, evt.wait)
|
||||||
|
|
||||||
def test_reset(self):
|
def test_reset(self):
|
||||||
@@ -83,7 +83,7 @@ class TestEvent(tests.TestCase):
|
|||||||
|
|
||||||
# calling reset before send should throw
|
# calling reset before send should throw
|
||||||
self.assertRaises(AssertionError, evt.reset)
|
self.assertRaises(AssertionError, evt.reset)
|
||||||
|
|
||||||
value = 'some stuff'
|
value = 'some stuff'
|
||||||
def send_to_event():
|
def send_to_event():
|
||||||
evt.send(value)
|
evt.send(value)
|
||||||
@@ -168,7 +168,7 @@ class TestCoroutinePool(tests.TestCase):
|
|||||||
# t = worker.wait()
|
# t = worker.wait()
|
||||||
# api.sleep(0)
|
# api.sleep(0)
|
||||||
# self.assertEquals(t.cancelled, True)
|
# self.assertEquals(t.cancelled, True)
|
||||||
|
|
||||||
def test_reentrant(self):
|
def test_reentrant(self):
|
||||||
pool = coros.CoroutinePool(0,1)
|
pool = coros.CoroutinePool(0,1)
|
||||||
def reenter():
|
def reenter():
|
||||||
@@ -182,10 +182,10 @@ class TestCoroutinePool(tests.TestCase):
|
|||||||
def reenter_async():
|
def reenter_async():
|
||||||
pool.execute_async(lambda a: a, 'reenter')
|
pool.execute_async(lambda a: a, 'reenter')
|
||||||
evt.send('done')
|
evt.send('done')
|
||||||
|
|
||||||
pool.execute_async(reenter_async)
|
pool.execute_async(reenter_async)
|
||||||
evt.wait()
|
evt.wait()
|
||||||
|
|
||||||
def test_horrible_main_loop_death(self):
|
def test_horrible_main_loop_death(self):
|
||||||
# testing the case that causes the run_forever
|
# testing the case that causes the run_forever
|
||||||
# method to exit unwantedly
|
# method to exit unwantedly
|
||||||
@@ -194,8 +194,8 @@ class TestCoroutinePool(tests.TestCase):
|
|||||||
raise RuntimeError("Whoa")
|
raise RuntimeError("Whoa")
|
||||||
class FakeFile(object):
|
class FakeFile(object):
|
||||||
write = crash
|
write = crash
|
||||||
|
|
||||||
# we're going to do this by causing the traceback.print_exc in
|
# we're going to do this by causing the traceback.print_exc in
|
||||||
# safe_apply to raise an exception and thus exit _main_loop
|
# safe_apply to raise an exception and thus exit _main_loop
|
||||||
normal_err = sys.stderr
|
normal_err = sys.stderr
|
||||||
try:
|
try:
|
||||||
@@ -307,7 +307,7 @@ class TestActor(tests.TestCase):
|
|||||||
raise RuntimeError()
|
raise RuntimeError()
|
||||||
else:
|
else:
|
||||||
msgs.append(message)
|
msgs.append(message)
|
||||||
|
|
||||||
self.actor.received = received
|
self.actor.received = received
|
||||||
|
|
||||||
evt = coros.event()
|
evt = coros.event()
|
||||||
@@ -326,16 +326,16 @@ class TestActor(tests.TestCase):
|
|||||||
total[0] += value
|
total[0] += value
|
||||||
ev.send()
|
ev.send()
|
||||||
self.actor.received = received
|
self.actor.received = received
|
||||||
|
|
||||||
def onemoment():
|
def onemoment():
|
||||||
api.sleep(0.1)
|
api.sleep(0.1)
|
||||||
|
|
||||||
evt = coros.event()
|
evt = coros.event()
|
||||||
evt1 = coros.event()
|
evt1 = coros.event()
|
||||||
|
|
||||||
self.actor.cast( (onemoment, evt, 1) )
|
self.actor.cast( (onemoment, evt, 1) )
|
||||||
self.actor.cast( (lambda: None, evt1, 2) )
|
self.actor.cast( (lambda: None, evt1, 2) )
|
||||||
|
|
||||||
evt1.wait()
|
evt1.wait()
|
||||||
self.assertEqual(total[0], 2)
|
self.assertEqual(total[0], 2)
|
||||||
# both coroutines should have been used
|
# both coroutines should have been used
|
||||||
|
Reference in New Issue
Block a user