Commits

Denis Bilenko committed 581cba6

fix tests not to use gevent.spawn_link*

Comments (0)

Files changed (4)

greentest/test__examples.py

             self.assertEqual(received, message)
             conn._sock.settimeout(0.1)
             self.assertRaises(socket.timeout, conn.read, 1)
-        client1 = gevent.spawn_link_exception(test_client, 'hello\r\n')
-        client2 = gevent.spawn_link_exception(test_client, 'world\r\n')
-        gevent.joinall([client1, client2])
+        client1 = gevent.spawn(test_client, 'hello\r\n')
+        client2 = gevent.spawn(test_client, 'world\r\n')
+        gevent.joinall([client1, client2], raise_error=True)
+
 
 
 class TestAllTested(unittest.TestCase):

greentest/test__greenlet.py

                 e.set_exception(sys.exc_info()[1])
                 gevent.sleep(0)
 
-        p = gevent.spawn_link(func)
+        p = gevent.Greenlet.spawn_link(func)
         try:
             try:
                 e.wait()

greentest/test__server.py

         self._test_invalid_callback()
 
     def _test_serve_forever(self):
-        g = gevent.spawn_link_exception(self.server.serve_forever)
+        g = gevent.spawn(self.server.serve_forever)
         try:
             gevent.sleep(0.01)
             self.assertRequestSucceeded()
             self.assertConnectionRefused()
         finally:
             g.kill()
+            g.get()
 
     def test_serve_forever(self):
         self.server = self.ServerSubClass(('127.0.0.1', 0))

greentest/test__socket.py

             (client, addr) = self.listener.accept()
             # start reading, then, while reading, start writing. the reader should not hang forever
             N = 100000  # must be a big enough number so that sendall calls trampoline
-            sender = gevent.spawn_link_exception(client.sendall, 't' * N)
+            sender = gevent.spawn(client.sendall, 't' * N)
             result = client.recv(1000)
             assert result == 'hello world', result
-            sender.join(0.2)
+            sender.join(timeout=0.2)
             sender.kill()
+            sender.get()
 
         #print '%s: client' % getcurrent()
 
-        server_proc = gevent.spawn_link_exception(server)
+        server_proc = gevent.spawn(server)
         client = self.create_connection()
-        client_reader = gevent.spawn_link_exception(client.makefile().read)
+        client_reader = gevent.spawn(client.makefile().read)
         gevent.sleep(0.001)
         client.send('hello world')
 
         client_reader.get()
 
     def test_recv_timeout(self):
-        acceptor = gevent.spawn_link_exception(self.listener.accept)
+        acceptor = gevent.spawn(self.listener.accept)
         try:
             client = self.create_connection()
             client.settimeout(0.1)
             acceptor.get()
 
     def test_sendall_timeout(self):
-        acceptor = gevent.spawn_link_exception(self.listener.accept)
+        acceptor = gevent.spawn(self.listener.accept)
         try:
             client = self.create_connection()
             client.settimeout(0.1)