Commit eb5a537e authored by Denis Bilenko's avatar Denis Bilenko

update the tests with regard to kill() bahviour change

parent e996abe3
...@@ -37,18 +37,12 @@ class Test(greentest.TestCase): ...@@ -37,18 +37,12 @@ class Test(greentest.TestCase):
state.append('except') state.append('except')
# catching GreenletExit # catching GreenletExit
pass pass
# when switching to hub, hub makes itself the parent of this greenlet,
# thus after the function's done, the control will go to the parent
# QQQ why the first sleep is not enough?
gevent.sleep(0)
state.append('finished') state.append('finished')
g = gevent.spawn(test) g = gevent.spawn(test)
gevent.sleep(DELAY/2) gevent.sleep(DELAY/2)
assert state == ['start'], state assert state == ['start'], state
gevent.kill(g) gevent.kill(g, wait=True)
# 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
gevent.sleep(DELAY)
assert state == ['start', 'except', 'finished'], state assert state == ['start', 'except', 'finished'], state
def test_nested_with_timeout(self): def test_nested_with_timeout(self):
......
...@@ -135,7 +135,8 @@ class TestHttpd(TestCase): ...@@ -135,7 +135,8 @@ class TestHttpd(TestCase):
socket.tcp_listener(('0.0.0.0', 12346)), self.site, max_size=128, log=self.logfile) socket.tcp_listener(('0.0.0.0', 12346)), self.site, max_size=128, log=self.logfile)
def tearDown(self): def tearDown(self):
gevent.kill(self.killer) gevent.kill(self.killer, wait=True)
gevent.sleep(0) # XXX kill should be enough!
def test_001_server(self): def test_001_server(self):
sock = socket.connect_tcp(('127.0.0.1', 12346)) sock = socket.connect_tcp(('127.0.0.1', 12346))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment