Commit f0e3bb96 authored by Jason Madden's avatar Jason Madden

test_invalid_callback skipped on Appveyor.

Also deprecate 'handle' as kwarg to WSGIServer. That's almost certainly not what anyone meant.
parent d2389867
......@@ -1389,6 +1389,8 @@ class WSGIServer(StreamServer):
.. versionchanged:: 1.1a3
Add support for passing :class:`logging.Logger` objects to the ``log`` and
``error_log`` arguments.
.. versionchanged:: NEXT
Passing a ``handle`` kwarg to the constructor is now officially deprecated.
"""
#: A callable taking three arguments: (socket, address, server) and returning
......@@ -1436,7 +1438,21 @@ class WSGIServer(StreamServer):
log='default', error_log='default',
handler_class=None,
environ=None, **ssl_args):
if 'handle' in ssl_args:
# The ultimate base class (BaseServer) uses 'handle' for
# the thing we call 'application'. We never deliberately
# bass a `handle` argument to the base class, but one
# could sneak in through ``**ssl_args``, even though that
# is not the intent, while application is None. That
# causes our own ``def handle`` method to be replaced,
# probably leading to bad results. Passing a 'handle'
# instead of an 'application' can really confuse things.
import warnings
warnings.warn("Passing 'handle' kwarg to WSGIServer is deprecated. "
"Did you mean application?", DeprecationWarning, stacklevel=2)
StreamServer.__init__(self, listener, backlog=backlog, spawn=spawn, **ssl_args)
if application is not None:
self.application = application
if handler_class is not None:
......
......@@ -7,6 +7,7 @@ import os
import gevent.testing as greentest
from gevent.testing import PY3
from gevent.testing import sysinfo
from gevent.testing import DEFAULT_SOCKET_TIMEOUT as _DEFAULT_SOCKET_TIMEOUT
from gevent.testing.timing import SMALLEST_RELIABLE_DELAY
from gevent.testing.sockets import tcp_listener
......@@ -250,10 +251,13 @@ class TestCase(greentest.TestCase):
return self.server.socket
def _test_invalid_callback(self):
try:
self.server = self.ServerClass((greentest.DEFAULT_BIND_ADDR, 0), lambda: None)
self.server.start()
if sysinfo.RUNNING_ON_APPVEYOR:
self.skipTest("Sometimes misses the error") # XXX: Why?
try:
# Can't use a kwarg here, WSGIServer and StreamServer
# take different things (application and handle)
self.init_server(lambda: None)
self.expect_one_error()
self.assert500()
......@@ -302,7 +306,7 @@ class TestDefaultSpawn(TestCase):
def test_backlog_is_not_accepted_for_socket(self):
self.switch_expected = False
with self.assertRaises(TypeError):
self.ServerClass(self.get_listener(), backlog=25, handle=False)
self.ServerClass(self.get_listener(), backlog=25)
def test_backlog_is_accepted_for_address(self):
self.server = self.ServerSubClass((greentest.DEFAULT_BIND_ADDR, 0), backlog=25)
......
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