From e58ea8c7b4fd541741223e3203c8fcede7b53c0e Mon Sep 17 00:00:00 2001 From: Yun Xu Date: Sat, 10 Nov 2018 06:26:55 -0800 Subject: [PATCH] fix unit test for windows ci fix unit tests for windows ci add appveyor build status badge add readthedoc build status badge --- README.rst | 4 +++- tests/test_multiprocessing.py | 4 ++++ tests/test_request_timeout.py | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 31f036b0..311be757 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ Sanic ===== -|Join the chat at https://gitter.im/sanic-python/Lobby| |Build Status| |Codecov| |PyPI| |PyPI version| |Code style black| +|Join the chat at https://gitter.im/sanic-python/Lobby| |Build Status| |AppVeyor Build Status| |Documentation| |Codecov| |PyPI| |PyPI version| |Code style black| 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 `_. @@ -51,6 +51,8 @@ Documentation :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 +.. |AppVeyor Build Status| image:: https://ci.appveyor.com/api/projects/status/d8pt3ids0ynexi8c/branch/master?svg=true + :target: https://ci.appveyor.com/project/huge-success/sanic .. |Documentation| image:: https://readthedocs.org/projects/sanic/badge/?version=latest :target: http://sanic.readthedocs.io/en/latest/?badge=latest .. |PyPI| image:: https://img.shields.io/pypi/v/sanic.svg diff --git a/tests/test_multiprocessing.py b/tests/test_multiprocessing.py index ac45ad61..45d6aaf2 100644 --- a/tests/test_multiprocessing.py +++ b/tests/test_multiprocessing.py @@ -31,6 +31,10 @@ def test_multiprocessing(app): assert len(process_list) == num_workers +@pytest.mark.skipif( + not hasattr(signal, 'SIGALRM'), + reason='SIGALRM is not implemented for this platform', +) def test_multiprocessing_with_blueprint(app): from sanic import Blueprint # Selects a number at random so we can spot check diff --git a/tests/test_request_timeout.py b/tests/test_request_timeout.py index 163547cb..e674e451 100644 --- a/tests/test_request_timeout.py +++ b/tests/test_request_timeout.py @@ -173,7 +173,7 @@ class DelayableSanicTestClient(SanicTestClient): return response -Config.REQUEST_TIMEOUT = 2 +Config.REQUEST_TIMEOUT = 0.6 request_timeout_default_app = Sanic('test_request_timeout_default') request_no_timeout_app = Sanic('test_request_no_timeout') @@ -189,14 +189,14 @@ async def handler2(request): def test_default_server_error_request_timeout(): - client = DelayableSanicTestClient(request_timeout_default_app, None, 3) + client = DelayableSanicTestClient(request_timeout_default_app, None, 2) request, response = client.get('/1') assert response.status == 408 assert response.text == 'Error: Request Timeout' def test_default_server_error_request_dont_timeout(): - client = DelayableSanicTestClient(request_no_timeout_app, None, 1) + client = DelayableSanicTestClient(request_no_timeout_app, None, 0.2) request, response = client.get('/1') assert response.status == 200 assert response.text == 'OK'