Merge branch 'fix-travis'
commit
5658910711
24
.travis.yml
24
.travis.yml
|
|
@ -1,17 +1,27 @@
|
|||
language: python
|
||||
cache: pip
|
||||
python:
|
||||
- '3.5'
|
||||
- '3.6'
|
||||
- '3.7'
|
||||
env:
|
||||
- TOX_ENV=py35
|
||||
- TOX_ENV=py36
|
||||
- TOX_ENV=py37
|
||||
- '3.7-dev'
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- python: "3.5"
|
||||
env: TOXENV=flake8
|
||||
|
||||
allow_failures:
|
||||
- env: TOXENV=flake8
|
||||
|
||||
install:
|
||||
- pip install requirements_dev.txt
|
||||
- pip install -r requirements_dev.txt
|
||||
|
||||
before_script:
|
||||
- coverage erase
|
||||
|
||||
script:
|
||||
- tox -e $TOX_ENV
|
||||
- tox
|
||||
|
||||
after_success:
|
||||
- coveralls
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
# Packages required for development and CI
|
||||
tox>=2.9.1
|
||||
tox-battery>=0.5
|
||||
tox-travis>=0.10
|
||||
python-coveralls>=2.9.1
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class _OpenAPICodec(BaseCodec):
|
|||
def validators(self):
|
||||
return self._validators
|
||||
|
||||
def encode(self, document, **options):
|
||||
def encode(self, document, **_):
|
||||
if not isinstance(document, openapi.Swagger):
|
||||
raise TypeError('Expected a `openapi.Swagger` instance')
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from django.utils.cache import add_never_cache_headers
|
|||
from django.utils.decorators import available_attrs
|
||||
from django.views.decorators.cache import cache_page
|
||||
from django.views.decorators.vary import vary_on_headers
|
||||
from rest_framework import exceptions, renderers
|
||||
from rest_framework import exceptions
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.settings import api_settings
|
||||
from rest_framework.views import APIView
|
||||
|
|
@ -14,7 +14,6 @@ from .generators import OpenAPISchemaGenerator
|
|||
from .renderers import (
|
||||
SwaggerJSONRenderer, SwaggerYAMLRenderer, SwaggerUIRenderer, ReDocRenderer, OpenAPIRenderer,
|
||||
)
|
||||
from .openapi import Info
|
||||
|
||||
SPEC_RENDERERS = (SwaggerYAMLRenderer, SwaggerJSONRenderer, OpenAPIRenderer)
|
||||
UI_RENDERERS = {
|
||||
|
|
@ -53,7 +52,7 @@ def get_schema_view(info, url=None, patterns=None, urlconf=None, *, public=False
|
|||
"""
|
||||
Create a SchemaView class with default renderers and generators.
|
||||
|
||||
:param Info info: Required. Swagger API Info object
|
||||
:param drf_swagger.openapi.Info info: Required. Swagger API Info object
|
||||
:param str url: API base url; if left blank will be deduced from the location the view is served at
|
||||
:param str patterns: passed to SchemaGenerator
|
||||
:param str urlconf: passed to SchemaGenerator
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if __name__ == "__main__":
|
|||
# issue is really that Django is missing to avoid masking other
|
||||
# exceptions on Python 2.
|
||||
try:
|
||||
import django
|
||||
import django # noqa: F401
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
|
|
|
|||
|
|
@ -1,3 +1 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
from rest_framework.status import HTTP_400_BAD_REQUEST
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from snippets.models import Snippet, LANGUAGE_CHOICES, STYLE_CHOICES
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import os
|
||||
|
||||
|
||||
class PytestTestRunner(object):
|
||||
"""Runs pytest to discover and run tests."""
|
||||
|
||||
def __init__(self, verbosity=1, failfast=False, keepdb=False, **kwargs):
|
||||
def __init__(self, verbosity=1, failfast=False, keepdb=False, **_):
|
||||
self.verbosity = verbosity
|
||||
self.failfast = failfast
|
||||
self.keepdb = keepdb
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import os
|
||||
|
||||
import sys
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
|
|
|||
|
|
@ -25,5 +25,5 @@ urlpatterns = [
|
|||
url(r'^redoc/$', schema_view.with_ui('redoc', cache_timeout=None), name='schema-redoc'),
|
||||
|
||||
url(r'^admin/', admin.site.urls),
|
||||
url(f'^snippets/', include('snippets.urls')),
|
||||
url(r'^snippets/', include('snippets.urls')),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import pytest
|
||||
from ruamel import yaml
|
||||
|
||||
from drf_swagger import openapi, codecs
|
||||
from drf_swagger.generators import OpenAPISchemaGenerator
|
||||
from ruamel import yaml
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
import json
|
||||
|
||||
from ruamel import yaml
|
||||
|
||||
import pytest
|
||||
from drf_swagger import openapi, codecs
|
||||
from drf_swagger.generators import OpenAPISchemaGenerator
|
||||
|
||||
import pytest
|
||||
from ruamel import yaml
|
||||
|
||||
|
||||
def validate_schema(swagger):
|
||||
|
|
|
|||
14
tox.ini
14
tox.ini
|
|
@ -1,5 +1,6 @@
|
|||
[tox]
|
||||
envlist = py35,py36,py37
|
||||
envlist = py35,py36,py37,flake8
|
||||
|
||||
[testenv]
|
||||
deps=
|
||||
-rrequirements.txt
|
||||
|
|
@ -7,3 +8,14 @@ deps=
|
|||
-rrequirements_test.txt
|
||||
commands=
|
||||
pytest --cov-append --cov=drf_swagger
|
||||
|
||||
[testenv:flake8]
|
||||
skip_install = true
|
||||
deps=
|
||||
flake8
|
||||
commands=
|
||||
flake8 drf_swagger testproj
|
||||
|
||||
[flake8]
|
||||
max-line-length = 120
|
||||
exclude = **/migrations/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue