Commit 01e8f114 authored by Jason Madden's avatar Jason Madden

Use init_server to try to fix an intermittant windows failure in test__server.

https://ci.appveyor.com/project/denik/gevent/builds/33296254/job/s630snlcgtqmq1fi
parent 3bd798e7
...@@ -235,11 +235,13 @@ class TestCase(greentest.TestCase): ...@@ -235,11 +235,13 @@ class TestCase(greentest.TestCase):
# with os.system. We can probably do better with psutil. # with os.system. We can probably do better with psutil.
return return
def _create_server(self): def _create_server(self, *args, **kwargs):
return self.ServerSubClass((greentest.DEFAULT_BIND_ADDR, 0)) kind = kwargs.pop('server_kind', self.ServerSubClass)
addr = kwargs.pop('server_listen_addr', (greentest.DEFAULT_BIND_ADDR, 0))
return kind(addr, *args, **kwargs)
def init_server(self): def init_server(self, *args, **kwargs):
self.server = self._create_server() self.server = self._create_server(*args, **kwargs)
self.server.start() self.server.start()
sleep_to_clear_old_sockets() sleep_to_clear_old_sockets()
...@@ -470,8 +472,7 @@ class TestNoneSpawn(TestCase): ...@@ -470,8 +472,7 @@ class TestNoneSpawn(TestCase):
def test_assertion_in_blocking_func(self): def test_assertion_in_blocking_func(self):
def sleep(*_args): def sleep(*_args):
gevent.sleep(SMALLEST_RELIABLE_DELAY) gevent.sleep(SMALLEST_RELIABLE_DELAY)
self.server = self.Settings.ServerClass((greentest.DEFAULT_BIND_ADDR, 0), sleep, spawn=None) self.init_server(sleep, server_kind=self.ServerSubClass, spawn=None)
self.server.start()
self.expect_one_error() self.expect_one_error()
self.assert500() self.assert500()
self.assert_error(AssertionError, 'Impossible to call blocking function in the event loop callback') self.assert_error(AssertionError, 'Impossible to call blocking function in the event loop callback')
......
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