diff --git a/.travis.yml b/.travis.yml index 1fa1df57..c18e895b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,14 @@ matrix: python: 3.6 - env: TOX_ENV=py36-no-ext python: 3.6 + - env: TOX_ENV=py37 + python: 3.7 + dist: xenial + sudo: true + - env: TOX_ENV=py37-no-ext + python: 3.7 + dist: xenial + sudo: true - env: TOX_ENV=flake8 python: 3.6 - env: TOX_ENV=check diff --git a/requirements.txt b/requirements.txt index b15a3572..05968bd8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ aiofiles httptools ujson; sys_platform != "win32" and implementation_name == "cpython" uvloop; sys_platform != "win32" and implementation_name == "cpython" -websockets>=4.0,<5.0 +websockets>=5.0,<6.0 diff --git a/sanic/server.py b/sanic/server.py index 15ae4708..fc8291b5 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -665,7 +665,7 @@ def serve(host, port, request_handler, error_handler, before_start=None, for conn in connections: if hasattr(conn, "websocket") and conn.websocket: coros.append( - conn.websocket.close_connection(after_handshake=True) + conn.websocket.close_connection() ) else: conn.close() diff --git a/sanic/worker.py b/sanic/worker.py index 3d8a4617..d367a7c3 100644 --- a/sanic/worker.py +++ b/sanic/worker.py @@ -116,7 +116,7 @@ class GunicornWorker(base.Worker): for conn in self.connections: if hasattr(conn, "websocket") and conn.websocket: coros.append( - conn.websocket.close_connection(after_handshake=False) + conn.websocket.close_connection() ) else: conn.close() diff --git a/setup.py b/setup.py index 5954b926..73cb559f 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ requirements = [ uvloop, ujson, 'aiofiles>=0.3.0', - 'websockets>=4.0,<5.0', + 'websockets>=5.0,<6.0', ] if strtobool(os.environ.get("SANIC_NO_UJSON", "no")): print("Installing without uJSON") diff --git a/tests/test_worker.py b/tests/test_worker.py index af00982e..0dcd1f38 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -131,5 +131,5 @@ def test_worker_close(worker): loop.run_until_complete(_close) assert worker.signal.stopped == True - conn.websocket.close_connection.assert_called_with(after_handshake=False) + assert conn.websocket.close_connection.called == True assert len(worker.servers) == 0 diff --git a/tox.ini b/tox.ini index a62368e2..cb8e4fc9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,11 @@ [tox] -envlist = py35, py36, {py35,py36}-no-ext, flake8, check +envlist = py35, py36, py37, {py35,py36,py37}-no-ext, flake8, check [testenv] usedevelop = True setenv = - {py35,py36}-no-ext: SANIC_NO_UJSON=1 - {py35,py36}-no-ext: SANIC_NO_UVLOOP=1 + {py35,py36,py37}-no-ext: SANIC_NO_UJSON=1 + {py35,py36,py37}-no-ext: SANIC_NO_UVLOOP=1 deps = coverage pytest==3.3.2