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
|
sudo: false
|
||||||
language: python
|
language: python
|
||||||
python:
|
cache:
|
||||||
- '3.5'
|
directories:
|
||||||
- '3.6'
|
- $HOME/.cache/pip
|
||||||
install: pip install tox-travis
|
matrix:
|
||||||
script: tox
|
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:
|
deploy:
|
||||||
provider: pypi
|
provider: pypi
|
||||||
user: channelcat
|
user: channelcat
|
||||||
|
|
|
@ -206,7 +206,12 @@ class Sanic:
|
||||||
def response(handler):
|
def response(handler):
|
||||||
async def websocket_handler(request, *args, **kwargs):
|
async def websocket_handler(request, *args, **kwargs):
|
||||||
request.app = self
|
request.app = self
|
||||||
|
try:
|
||||||
protocol = request.transport.get_protocol()
|
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)
|
ws = await protocol.websocket_handshake(request)
|
||||||
|
|
||||||
# schedule the application handler
|
# schedule the application handler
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
from cgi import parse_header
|
from cgi import parse_header
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from http.cookies import SimpleCookie
|
from http.cookies import SimpleCookie
|
||||||
|
@ -7,7 +9,12 @@ from urllib.parse import parse_qs, urlunparse
|
||||||
try:
|
try:
|
||||||
from ujson import loads as json_loads
|
from ujson import loads as json_loads
|
||||||
except ImportError:
|
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.exceptions import InvalidUsage
|
||||||
from sanic.log import log
|
from sanic.log import log
|
||||||
|
|
|
@ -2,7 +2,11 @@ import random
|
||||||
|
|
||||||
from sanic import Sanic
|
from sanic import Sanic
|
||||||
from sanic.response import json
|
from sanic.response import json
|
||||||
from ujson import loads
|
|
||||||
|
try:
|
||||||
|
from ujson import loads
|
||||||
|
except ImportError:
|
||||||
|
from json import loads
|
||||||
|
|
||||||
|
|
||||||
def test_storage():
|
def test_storage():
|
||||||
|
|
21
tox.ini
21
tox.ini
|
@ -1,17 +1,18 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py35, py36, flake8, check
|
envlist = py35, py36, {py35,py36}-no-ext, flake8, check
|
||||||
|
|
||||||
|
|
||||||
[travis]
|
|
||||||
python =
|
|
||||||
3.5: py35, flake8, check
|
|
||||||
3.6: py36, flake8, check
|
|
||||||
|
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
usedevelop = True
|
||||||
|
setenv =
|
||||||
|
{py35,py36}-no-ext: SANIC_NO_UJSON=1
|
||||||
|
{py35,py36}-no-ext: SANIC_NO_UVLOOP=1
|
||||||
deps =
|
deps =
|
||||||
-rrequirements-dev.txt
|
coverage
|
||||||
|
pytest
|
||||||
|
pytest-sugar
|
||||||
|
aiohttp==1.3.5
|
||||||
|
chardet<=2.3.0
|
||||||
|
beautifulsoup4
|
||||||
commands =
|
commands =
|
||||||
pytest tests {posargs}
|
pytest tests {posargs}
|
||||||
coverage erase
|
coverage erase
|
||||||
|
|
Loading…
Reference in New Issue
Block a user