From 2629fab649785c441eeed9401464153047ce5be4 Mon Sep 17 00:00:00 2001 From: Yun Xu Date: Sat, 10 Nov 2018 05:50:22 -0800 Subject: [PATCH 1/3] add .appveyor.yml for windows ci support --- .appveyor.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 00000000..75440426 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,37 @@ +version: "{branch}.{build}" + +environment: + matrix: + - TOXENV: py35-no-ext + PYTHON: "C:\\Python35-x64" + PYTHON_VERSION: "3.5.x" + PYTHON_ARCH: "64" + + - TOXENV: py36-no-ext + PYTHON: "C:\\Python36-x64" + PYTHON_VERSION: "3.6.x" + PYTHON_ARCH: "64" + + - TOXENV: py37-no-ext + PYTHON: "C:\\Python37-x64" + PYTHON_VERSION: "3.7.x" + PYTHON_ARCH: "64" + +init: SET "PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + +install: + - pip install tox + +build: off + +test_script: tox + +cache: + # Not including the .tox directory since it takes longer to download/extract + # the cache archive than for tox to clean install from the pip cache. + - "%LOCALAPPDATA%\pip\Cache -> tox.ini" + +notifications: + - provider: Email + on_build_success: false + on_build_status_changed: false From 8b5d137d8f04413e5d19c27e3db65df709dbef8b Mon Sep 17 00:00:00 2001 From: Yun Xu Date: Sat, 10 Nov 2018 06:11:01 -0800 Subject: [PATCH 2/3] fix .appveyor.yml --- .appveyor.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 75440426..368270c5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,11 +26,6 @@ build: off test_script: tox -cache: - # Not including the .tox directory since it takes longer to download/extract - # the cache archive than for tox to clean install from the pip cache. - - "%LOCALAPPDATA%\pip\Cache -> tox.ini" - notifications: - provider: Email on_build_success: false From e58ea8c7b4fd541741223e3203c8fcede7b53c0e Mon Sep 17 00:00:00 2001 From: Yun Xu Date: Sat, 10 Nov 2018 06:26:55 -0800 Subject: [PATCH 3/3] 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'