sanic/tests
Ashley Sommer 6ffc4d9756
New websockets (#2158)
* First attempt at new Websockets implementation based on websockets >= 9.0, with sans-i/o features. Requires more work.

* Update sanic/websocket.py

Co-authored-by: Adam Hopkins <adam@amhopkins.com>

* Update sanic/websocket.py

Co-authored-by: Adam Hopkins <adam@amhopkins.com>

* Update sanic/websocket.py

Co-authored-by: Adam Hopkins <adam@amhopkins.com>

* wip, update websockets code to new Sans/IO API

* Refactored new websockets impl into own modules
Incorporated other suggestions made by team

* Another round of work on the new websockets impl
* Added websocket_timeout support (matching previous/legacy support)
* Lots more comments
* Incorporated suggested changes from previous round of review
* Changed RuntimeError usage to ServerError
* Changed SanicException usage to ServerError
* Removed some redundant asserts
* Change remaining asserts to ServerErrors
* Fixed some timeout handling issues
* Fixed websocket.close() handling, and made it more robust
* Made auto_close task smarter and more error-resilient
* Made fail_connection routine smarter and more error-resilient

* Further new websockets impl fixes
* Update compatibility with Websockets v10
* Track server connection state in a more precise way
* Try to handle the shutdown process more gracefully
* Add a new end_connection() helper, to use as an alterative to close() or fail_connection()
* Kill the auto-close task and keepalive-timeout task when sanic is shutdown
* Deprecate WEBSOCKET_READ_LIMIT and WEBSOCKET_WRITE_LIMIT configs, they are not used in this implementation.

* Change a warning message to debug level
Remove default values for deprecated websocket parameters

* Fix flake8 errors

* Fix a couple of missed failing tests

* remove websocket bench from examples

* Integrate suggestions from code reviews
Use Optional[T] instead of union[T,None]
Fix mypy type logic errors
change "is not None" to truthy checks where appropriate
change "is None" to falsy checks were appropriate
Add more debug logging when debug mode is on
Change to using sanic.logger for debug logging rather than error_logger.

* Fix long line lengths of debug messages
Add some new debug messages when websocket IO is paused and unpaused for flow control
Fix websocket example to use app.static()

* remove unused import in websocket example app

* re-run isort after Flake8 fixes

Co-authored-by: Adam Hopkins <adam@amhopkins.com>
Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
2021-09-29 13:09:23 +03:00
..
benchmark Perf improv (#2074) 2021-03-21 09:47:21 +02:00
certs initial commit 2017-03-03 11:44:50 -05:00
fake support app factory patten in CLI (#2157) 2021-06-09 12:05:56 +03:00
performance Fix imports and isort to remove from Makefile deprecated options (#1891) 2020-07-07 16:13:03 +03:00
static Static dir 2075 (#2076) 2021-03-21 15:03:54 +02:00
conftest.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
skip_test_custom_protocol.py Streaming Server (#1876) 2021-01-11 00:45:36 +02:00
test_app.py New websockets (#2158) 2021-09-29 13:09:23 +03:00
test_asgi.py New websockets (#2158) 2021-09-29 13:09:23 +03:00
test_bad_request.py squash 2021-02-01 09:56:58 +02:00
test_base.py Cleanup conftest and fix warning message (#2147) 2021-05-31 22:41:41 +03:00
test_blueprint_copy.py Copy Blueprints Implementation (#2184) 2021-08-10 01:07:04 +03:00
test_blueprint_group.py Adds Blueprint Group exception decorator (#2238) 2021-09-12 22:02:59 +03:00
test_blueprints.py Require stricter object names (#2146) 2021-05-30 15:37:44 +03:00
test_cli.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_config.py Remove Duplicated Dependencies and PEP 517 Support (#2173) 2021-07-08 09:12:56 +03:00
test_constants.py Remove unnecessary import in test_constants.py, which also fixes an error on win (#2180) 2021-07-05 11:51:36 +03:00
test_cookies.py Clean up use cases: 2021-02-03 22:36:44 +02:00
test_create_task.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_custom_request.py Streaming Server (#1876) 2021-01-11 00:45:36 +02:00
test_dynamic_routes.py Add SanicBase 2021-01-28 09:18:06 +02:00
test_errorpages.py Add text and json fallback error handlers (#1937) 2020-09-30 15:11:27 +03:00
test_exceptions_handler.py Blueprint specific exception handlers (#2208) 2021-08-31 12:32:51 +03:00
test_exceptions.py New websockets (#2158) 2021-09-29 13:09:23 +03:00
test_graceful_shutdown.py Close HTTP loop when connection task cancelled (#2245) 2021-09-27 10:22:30 +03:00
test_handler_annotations.py Add convenience for annotated handlers (#2225) 2021-08-30 20:04:44 +03:00
test_headers.py Accept header parsing (#2200) 2021-08-19 21:09:40 +03:00
test_helpers.py Add custom request support to ASGI mode; fix a couple tests 2019-06-24 22:59:23 +03:00
test_http.py HTTP tests (#2194) 2021-07-19 16:52:33 +03:00
test_json_encoding.py JSON encoder change via app (#2055) 2021-03-11 17:09:18 +02:00
test_keep_alive_timeout.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_logging.py Move server.py into its own module (#2230) 2021-08-31 11:51:32 +03:00
test_logo.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_middleware.py Add ability to return Falsey but not-None from handlers (#2236) 2021-09-12 07:19:26 +03:00
test_multiprocessing.py Add convenience decorators for new listeners (#2064) 2021-03-16 11:21:05 +02:00
test_named_routes.py v2 AST router (#2133) 2021-06-21 15:10:26 +03:00
test_payload_too_large.py debug and working stage--squash 2021-02-08 12:18:29 +02:00
test_pipelining.py Fix issues with after request handling in HTTP pipelining (#2201) 2021-07-28 11:38:28 +03:00
test_redirect.py deprecate abort (#2077) 2021-04-05 18:01:48 +03:00
test_reloader.py Add reloading on addtional directories (#2167) 2021-06-18 11:39:09 +03:00
test_request_cancel.py GIT-1591 Strict Slashes behavior fix (#1594) 2019-06-06 07:21:58 -05:00
test_request_data.py Fix linting issues 2020-09-29 00:40:24 +03:00
test_request_stream.py deprecate abort (#2077) 2021-04-05 18:01:48 +03:00
test_request_timeout.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_request.py Accept header parsing (#2200) 2021-08-19 21:09:40 +03:00
test_requests.py v2 AST router (#2133) 2021-06-21 15:10:26 +03:00
test_response_timeout.py Disable response timeout on websocket connections (#2081) 2021-03-23 01:20:17 +02:00
test_response.py 21.6 Changelog, release version, and deprecations (#2172) 2021-06-27 22:52:56 +03:00
test_routes.py New websockets (#2158) 2021-09-29 13:09:23 +03:00
test_server_events.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_signal_handlers.py Close HTTP loop when connection task cancelled (#2245) 2021-09-27 10:22:30 +03:00
test_signals.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_static.py Static DIR and FILE resource types (#2244) 2021-09-26 01:01:23 +03:00
test_test_client_port.py Remove test client (#2009) 2021-01-28 09:22:22 +02:00
test_timeout_logic.py deprecate abort (#2077) 2021-04-05 18:01:48 +03:00
test_touchup.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_unix_socket.py GIT-2023: Enable GitHub Actions support (#2050) 2021-04-06 23:32:01 +03:00
test_url_building.py v2 AST router (#2133) 2021-06-21 15:10:26 +03:00
test_url_for_static.py Resolve some more tests 2021-02-07 11:38:37 +02:00
test_url_for.py Signals Integration (#2160) 2021-08-05 22:55:42 +03:00
test_utf8.py Swap out requests-async for httpx (#1728) 2019-12-20 19:23:52 -08:00
test_utils.py 21.3 deprecations (#2007) 2021-01-19 01:36:50 +02:00
test_versioning.py Version prefix (#2137) 2021-05-19 13:32:40 +03:00
test_vhosts.py debug and working stage--squash 2021-02-08 12:18:29 +02:00
test_views.py CBV alternate attach; CompositionView deprecate (#2170) 2021-06-21 14:26:42 +03:00
test_worker.py New websockets (#2158) 2021-09-29 13:09:23 +03:00