From c796d73fc393cb744d7553157f5b36b474be57ca Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sun, 7 Oct 2018 00:14:37 +0200 Subject: [PATCH 1/4] Add test for `config.from_object`. --- tests/test_config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_config.py b/tests/test_config.py index 14b28d46..08461b81 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -89,6 +89,16 @@ def test_overwrite_exisiting_config(app): assert app.config.DEFAULT == 2 +def test_overwrite_exisiting_config_ignore_lowercase(app): + app.config.default = 1 + + class Config: + default = 2 + + app.config.from_object(Config) + assert app.config.default == 1 + + def test_missing_config(app): with pytest.raises(AttributeError) as e: app.config.NON_EXISTENT From 1fe7306af828f47ba24c3c35ede01984ac33d8ed Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sun, 7 Oct 2018 01:32:36 +0200 Subject: [PATCH 2/4] Add missed documentation for config section. --- docs/sanic/config.md | 16 +++++++++------- sanic/server.py | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/sanic/config.md b/docs/sanic/config.md index 5d0dc95a..c16e2397 100644 --- a/docs/sanic/config.md +++ b/docs/sanic/config.md @@ -85,13 +85,15 @@ DB_USER = 'appuser' Out of the box there are just a few predefined values which can be overwritten when creating the application. - | Variable | Default | Description | - | ------------------ | --------- | --------------------------------------------- | - | REQUEST_MAX_SIZE | 100000000 | How big a request may be (bytes) | - | REQUEST_TIMEOUT | 60 | How long a request can take to arrive (sec) | - | RESPONSE_TIMEOUT | 60 | How long a response can take to process (sec) | - | KEEP_ALIVE | True | Disables keep-alive when False | - | KEEP_ALIVE_TIMEOUT | 5 | How long to hold a TCP connection open (sec) | + | Variable | Default | Description | + | ------------------------- | --------- | ------------------------------------------------------ | + | REQUEST_MAX_SIZE | 100000000 | How big a request may be (bytes) | + | REQUEST_TIMEOUT | 60 | How long a request can take to arrive (sec) | + | RESPONSE_TIMEOUT | 60 | How long a response can take to process (sec) | + | KEEP_ALIVE | True | Disables keep-alive when False | + | KEEP_ALIVE_TIMEOUT | 5 | How long to hold a TCP connection open (sec) | + | GRACEFUL_SHUTDOWN_TIMEOUT | 15.0 | How long take to force close non-idle connection (sec) | + | ACCESS_LOG | True | Disable or enable access log | ### The different Timeout variables: diff --git a/sanic/server.py b/sanic/server.py index 17529a32..5668c5c4 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -544,6 +544,8 @@ def serve(host, port, request_handler, error_handler, before_start=None, quarter of the high-water limit. :param is_request_stream: disable/enable Request.stream :param router: Router object + :param graceful_shutdown_timeout: How long take to Force close non-idle + connection :return: Nothing """ if not run_async: From d59e92d3e5a614f6bfc32a07fd52dd7b805beee3 Mon Sep 17 00:00:00 2001 From: Yun Xu Date: Sat, 6 Oct 2018 21:31:04 -0700 Subject: [PATCH 3/4] integrate with codecov --- .travis.yml | 6 +++++- README.rst | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83f13caf..b2aa37b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,8 +25,12 @@ matrix: python: 3.6 - env: TOX_ENV=check python: 3.6 -install: pip install -U tox +install: + - pip install -U tox + - pip install codecov script: travis_retry tox -e $TOX_ENV +after_success: + - codecov deploy: provider: pypi user: channelcat diff --git a/README.rst b/README.rst index 2b3f1606..1584b2a2 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ Sanic ===== -|Join the chat at https://gitter.im/sanic-python/Lobby| |Build Status| |PyPI| |PyPI version| +|Join the chat at https://gitter.im/sanic-python/Lobby| |Build Status| |Codecov| |PyPI| |PyPI version| Sanic is a Flask-like Python 3.5+ web server that's written to go fast. It's based on the work done by the amazing folks at magicstack, and was inspired by `this article `_. @@ -47,6 +47,8 @@ Documentation .. |Join the chat at https://gitter.im/sanic-python/Lobby| image:: https://badges.gitter.im/sanic-python/Lobby.svg :target: https://gitter.im/sanic-python/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge +.. |Codecov| image:: https://codecov.io/gh/yunstanford/sanic/branch/integrate-with-codecov/graph/badge.svg + :target: https://codecov.io/gh/yunstanford/sanic .. |Build Status| image:: https://travis-ci.org/huge-success/sanic.svg?branch=master :target: https://travis-ci.org/huge-success/sanic .. |Documentation| image:: https://readthedocs.org/projects/sanic/badge/?version=latest From 6deb9b49b2e32dd29df9e979e4986458f138d11e Mon Sep 17 00:00:00 2001 From: Yun Xu Date: Sat, 6 Oct 2018 21:39:04 -0700 Subject: [PATCH 4/4] correct Codecov badge url --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 1584b2a2..44c0a484 100644 --- a/README.rst +++ b/README.rst @@ -47,8 +47,8 @@ Documentation .. |Join the chat at https://gitter.im/sanic-python/Lobby| image:: https://badges.gitter.im/sanic-python/Lobby.svg :target: https://gitter.im/sanic-python/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge -.. |Codecov| image:: https://codecov.io/gh/yunstanford/sanic/branch/integrate-with-codecov/graph/badge.svg - :target: https://codecov.io/gh/yunstanford/sanic +.. |Codecov| image:: https://codecov.io/gh/huge-success/sanic/branch/master/graph/badge.svg + :target: https://codecov.io/gh/huge-success/sanic .. |Build Status| image:: https://travis-ci.org/huge-success/sanic.svg?branch=master :target: https://travis-ci.org/huge-success/sanic .. |Documentation| image:: https://readthedocs.org/projects/sanic/badge/?version=latest