From 5fe09c2a2e595c858f7a23a13cf6366f637d908e Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Tue, 16 Dec 2008 21:16:12 +0600 Subject: [PATCH] added [failing] test for coros.event send method bug --- greentest/test__event.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/greentest/test__event.py b/greentest/test__event.py index dcbac76..6ae713b 100644 --- a/greentest/test__event.py +++ b/greentest/test__event.py @@ -1,7 +1,8 @@ +from __future__ import with_statement import unittest import sys from eventlet.coros import event, Job, JobGroup -from eventlet.api import spawn, sleep, GreenletExit, exc_after +from eventlet.api import spawn, sleep, GreenletExit, exc_after, timeout DELAY= 0.01 @@ -23,6 +24,18 @@ class TestEvent(unittest.TestCase): sleep(0) assert log == [('catched', 'Exception')], log + def test_send(self): + event1 = event() + event2 = event() + + spawn(event1.send, 'hello event1') + exc_after(0, ValueError('interrupted')) + try: + result = event1.wait() + except ValueError: + with timeout(DELAY, None): + result = event2.wait() + raise AssertionError('Nobody sent anything to event2 yet it received %r' % (result, )) class CommonJobTests: