summaryrefslogtreecommitdiff
path: root/greentest
diff options
context:
space:
mode:
authorDenis Bilenko <denis@ag-projects.com>2008-12-15 13:42:32 +0600
committerDenis Bilenko <denis@ag-projects.com>2008-12-15 13:42:32 +0600
commit4c7aa2e27a714e72bde373242f9bbb662c8a9672 (patch)
treede77924902e2e1b218998359320e6e6764627f11 /greentest
parentfd99f7ce9e4ab25f3bcace8b1e8bfcd420bc1ff9 (diff)
downloadeventlet-4c7aa2e27a714e72bde373242f9bbb662c8a9672.tar.gz
Job's __init__ now accepts event as a parameter instead of a function; to spawn a function either use 'spawn' method or spawn_new classmethod
Diffstat (limited to 'greentest')
-rw-r--r--greentest/test__event.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/greentest/test__event.py b/greentest/test__event.py
index 6f9f500..810a439 100644
--- a/greentest/test__event.py
+++ b/greentest/test__event.py
@@ -25,12 +25,12 @@ class TestEvent(unittest.TestCase):
class TestJob(unittest.TestCase):
def test_simple_return(self):
- res = Job(lambda: 25).wait()
+ res = Job.spawn_new(lambda: 25).wait()
assert res==25, res
def test_exception(self):
try:
- Job(sys.exit, 'bye').wait()
+ Job.spawn_new(sys.exit, 'bye').wait()
except SystemExit, ex:
assert ex.args == ('bye', )
else:
@@ -40,7 +40,7 @@ class TestJob(unittest.TestCase):
def func():
sleep(0.1)
return 101
- res = Job(func)
+ res = Job.spawn_new(func)
assert res
if sync:
res.kill()
@@ -60,14 +60,14 @@ class TestJob(unittest.TestCase):
def func():
sleep(0.1)
return 25
- job = Job(func)
+ job = Job.spawn_new(func)
self.assertEqual(job.poll(), None)
assert job, repr(job)
self.assertEqual(job.wait(), 25)
self.assertEqual(job.poll(), 25)
assert not job, repr(job)
- job = Job(func)
+ job = Job.spawn_new(func)
self.assertEqual(job.poll(5), 5)
assert job, repr(job)
self.assertEqual(job.wait(), 25)
@@ -78,12 +78,12 @@ class TestJob(unittest.TestCase):
def func():
sleep(0.1)
return 25
- job = Job(func)
+ job = Job.spawn_new(func)
job.kill_after(0.05)
result = job.wait()
assert isinstance(result, GreenletExit), repr(result)
- job = Job(func)
+ job = Job.spawn_new(func)
job.kill_after(0.2)
self.assertEqual(job.wait(), 25)
sleep(0.2)