Merge pull request #722 from messense/feature/ci-without-ext
Add py3*-no-ext test env
This commit is contained in:
commit
974fe25a11
24
.travis.yml
24
.travis.yml
|
@ -1,10 +1,24 @@
|
|||
sudo: false
|
||||
language: python
|
||||
python:
|
||||
- '3.5'
|
||||
- '3.6'
|
||||
install: pip install tox-travis
|
||||
script: tox
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache/pip
|
||||
matrix:
|
||||
include:
|
||||
- env: TOX_ENV=py35
|
||||
python: 3.5
|
||||
- env: TOX_ENV=py35-no-ext
|
||||
python: 3.5
|
||||
- env: TOX_ENV=py36
|
||||
python: 3.6
|
||||
- env: TOX_ENV=py36-no-ext
|
||||
python: 3.6
|
||||
- env: TOX_ENV=flake8
|
||||
python: 3.6
|
||||
- env: TOX_ENV=check
|
||||
python: 3.6
|
||||
install: pip install -U tox
|
||||
script: tox -e $TOX_ENV
|
||||
deploy:
|
||||
provider: pypi
|
||||
user: channelcat
|
||||
|
|
|
@ -206,7 +206,12 @@ class Sanic:
|
|||
def response(handler):
|
||||
async def websocket_handler(request, *args, **kwargs):
|
||||
request.app = self
|
||||
try:
|
||||
protocol = request.transport.get_protocol()
|
||||
except AttributeError:
|
||||
# On Python3.5 the Transport classes in asyncio do not
|
||||
# have a get_protocol() method as in uvloop
|
||||
protocol = request.transport._protocol
|
||||
ws = await protocol.websocket_handshake(request)
|
||||
|
||||
# schedule the application handler
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import sys
|
||||
import json
|
||||
from cgi import parse_header
|
||||
from collections import namedtuple
|
||||
from http.cookies import SimpleCookie
|
||||
|
@ -7,7 +9,12 @@ from urllib.parse import parse_qs, urlunparse
|
|||
try:
|
||||
from ujson import loads as json_loads
|
||||
except ImportError:
|
||||
from json import loads as json_loads
|
||||
if sys.version_info[:2] == (3, 5):
|
||||
def json_loads(data):
|
||||
# on Python 3.5 json.loads only supports str not bytes
|
||||
return json.loads(data.decode())
|
||||
else:
|
||||
json_loads = json.loads
|
||||
|
||||
from sanic.exceptions import InvalidUsage
|
||||
from sanic.log import log
|
||||
|
|
|
@ -2,7 +2,11 @@ import random
|
|||
|
||||
from sanic import Sanic
|
||||
from sanic.response import json
|
||||
from ujson import loads
|
||||
|
||||
try:
|
||||
from ujson import loads
|
||||
except ImportError:
|
||||
from json import loads
|
||||
|
||||
|
||||
def test_storage():
|
||||
|
|
21
tox.ini
21
tox.ini
|
@ -1,17 +1,18 @@
|
|||
[tox]
|
||||
envlist = py35, py36, flake8, check
|
||||
|
||||
|
||||
[travis]
|
||||
python =
|
||||
3.5: py35, flake8, check
|
||||
3.6: py36, flake8, check
|
||||
|
||||
envlist = py35, py36, {py35,py36}-no-ext, flake8, check
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
setenv =
|
||||
{py35,py36}-no-ext: SANIC_NO_UJSON=1
|
||||
{py35,py36}-no-ext: SANIC_NO_UVLOOP=1
|
||||
deps =
|
||||
-rrequirements-dev.txt
|
||||
|
||||
coverage
|
||||
pytest
|
||||
pytest-sugar
|
||||
aiohttp==1.3.5
|
||||
chardet<=2.3.0
|
||||
beautifulsoup4
|
||||
commands =
|
||||
pytest tests {posargs}
|
||||
coverage erase
|
||||
|
|
Loading…
Reference in New Issue
Block a user