Improve testing (#415)
These changes: - Fix the lint and the djmaster jobs - Fix compatibility with upcoming Django 3.0 - Replace jobs with matrix in .travis.yml - Add a test job for Python 3.8 - Allow running tests on any branchmaster
parent
16f67cd8c2
commit
9a89d8ccb0
|
|
@ -4,12 +4,13 @@ python:
|
|||
- '3.5'
|
||||
- '3.6'
|
||||
- '3.7'
|
||||
- '3.8-dev'
|
||||
|
||||
dist: xenial
|
||||
|
||||
cache: pip
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
include:
|
||||
- python: '3.6'
|
||||
env: TOXENV=docs
|
||||
|
|
@ -38,6 +39,7 @@ jobs:
|
|||
allow_failures:
|
||||
- env: TOXENV=lint
|
||||
- env: TOXENV=djmaster
|
||||
- python: '3.8-dev'
|
||||
|
||||
fast_finish: true
|
||||
|
||||
|
|
@ -59,11 +61,6 @@ after_success:
|
|||
codecov
|
||||
fi
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^v?\d+\.\d+(\.\d+)?(-?\S+)?$/
|
||||
|
||||
stages:
|
||||
- test
|
||||
- name: publish
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
# test project requirements
|
||||
Pillow>=4.3.0
|
||||
django-cors-headers>=2.1.0
|
||||
django-filter>=1.1.0,<2.0; python_version == "2.7"
|
||||
django-filter>=1.1.0; python_version >= "3.5"
|
||||
#djangorestframework-camel-case>=0.2.0
|
||||
|
|
@ -9,5 +8,3 @@ django-filter>=1.1.0; python_version >= "3.5"
|
|||
djangorestframework-recursive>=0.1.2
|
||||
dj-database-url>=0.4.2
|
||||
user_agents>=1.1.0
|
||||
# django-oauth-toolkit 1.2 does not support Django 1.11
|
||||
django-oauth-toolkit>=1.1.0,<1.2.0
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import six
|
|||
|
||||
from django.shortcuts import resolve_url
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.encoding import force_str
|
||||
from django.utils.functional import Promise
|
||||
from rest_framework.renderers import BaseRenderer, JSONRenderer, TemplateHTMLRenderer
|
||||
from rest_framework.utils import encoders, json
|
||||
|
|
@ -124,7 +124,7 @@ class SwaggerUIRenderer(_UIRenderer):
|
|||
swagger_ui_settings = self.get_swagger_ui_settings()
|
||||
|
||||
request = renderer_context.get('request', None)
|
||||
oauth_redirect_url = force_text(swagger_ui_settings.get('oauth2RedirectUrl', ''))
|
||||
oauth_redirect_url = force_str(swagger_ui_settings.get('oauth2RedirectUrl', ''))
|
||||
if request and oauth_redirect_url:
|
||||
swagger_ui_settings['oauth2RedirectUrl'] = request.build_absolute_uri(oauth_redirect_url)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from collections import OrderedDict
|
|||
from decimal import Decimal
|
||||
|
||||
from django.db import models
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.encoding import force_str
|
||||
from rest_framework import serializers, status
|
||||
from rest_framework.mixins import DestroyModelMixin, ListModelMixin, RetrieveModelMixin, UpdateModelMixin
|
||||
from rest_framework.parsers import FileUploadParser
|
||||
|
|
@ -434,7 +434,7 @@ def force_real_str(s, encoding='utf-8', strings_only=False, errors='strict'):
|
|||
Fix for https://github.com/axnsan12/drf-yasg/issues/159
|
||||
"""
|
||||
if s is not None:
|
||||
s = force_text(s, encoding, strings_only, errors)
|
||||
s = force_str(s, encoding, strings_only, errors)
|
||||
if type(s) != str:
|
||||
s = '' + s
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import warnings
|
||||
from functools import wraps
|
||||
from functools import WRAPPER_ASSIGNMENTS, wraps
|
||||
|
||||
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
|
||||
|
|
@ -30,7 +29,7 @@ def deferred_never_cache(view_func):
|
|||
never be cached.
|
||||
"""
|
||||
|
||||
@wraps(view_func, assigned=available_attrs(view_func))
|
||||
@wraps(view_func, assigned=WRAPPER_ASSIGNMENTS)
|
||||
def _wrapped_view_func(request, *args, **kwargs):
|
||||
response = view_func(request, *args, **kwargs)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ else:
|
|||
from django.core.validators import MaxLengthValidator, MinValueValidator
|
||||
|
||||
|
||||
|
||||
class LanguageSerializer(serializers.Serializer):
|
||||
name = serializers.ChoiceField(
|
||||
choices=LANGUAGE_CHOICES, default='python', help_text='The name of the programming language')
|
||||
|
|
|
|||
23
tox.ini
23
tox.ini
|
|
@ -8,9 +8,10 @@ envlist =
|
|||
py27-django111-drf39-typing,
|
||||
py27-django111-drf{38,39},
|
||||
py{35,36}-django{111,21,22}-drf{38,39},
|
||||
py37-django{21,22}-drf{38,39},
|
||||
py37-django{21,22}-drf310,
|
||||
py37-django{21,22}-drf{38,39,310},
|
||||
py38-django22-drf310,
|
||||
djmaster, lint, docs
|
||||
skip_missing_interpreters = true
|
||||
|
||||
[testenv:.package]
|
||||
# no additional dependencies besides PEP 517
|
||||
|
|
@ -19,8 +20,17 @@ deps =
|
|||
[testenv]
|
||||
deps =
|
||||
django111: Django>=1.11,<2.0
|
||||
django111: django-cors-headers>=2.1.0
|
||||
django111: django-oauth-toolkit>=1.1.0,<1.2.0
|
||||
|
||||
django21: Django>=2.1,<2.2
|
||||
django21: django-cors-headers>=2.1.0
|
||||
django21: django-oauth-toolkit>=1.2.0
|
||||
|
||||
django22: Django>=2.2,<2.3
|
||||
django22: django-cors-headers>=2.1.0
|
||||
django22: django-oauth-toolkit>=1.2.0
|
||||
|
||||
|
||||
drf38: djangorestframework>=3.8,<3.9
|
||||
drf39: djangorestframework>=3.9,<3.10
|
||||
|
|
@ -28,9 +38,12 @@ deps =
|
|||
|
||||
typing: typing>=3.6.6
|
||||
|
||||
# test with the latest build of django-rest-framework to get early warning of compatibility issues
|
||||
djmaster: https://github.com/encode/django-rest-framework/archive/master.tar.gz
|
||||
# test with the latest builds of Django and django-rest-framework
|
||||
# to get early warning of compatibility issues
|
||||
djmaster: https://github.com/django/django/archive/master.tar.gz
|
||||
djmaster: https://github.com/ottoyiu/django-cors-headers/archive/master.tar.gz
|
||||
djmaster: https://github.com/encode/django-rest-framework/archive/master.tar.gz
|
||||
djmaster: django-oauth-toolkit>=1.2.0
|
||||
|
||||
# other dependencies
|
||||
-r requirements/validation.txt
|
||||
|
|
@ -77,5 +90,5 @@ known_standard_library =
|
|||
known_third_party =
|
||||
coreapi,coreschema,datadiff,dj_database_url,django,django_filters,djangorestframework_camel_case,
|
||||
rest_framework_recursive,flex,gunicorn,inflection,pytest,rest_framework,ruamel,setuptools_scm,
|
||||
swagger_spec_validator,uritemplate,user_agents,whitenoise,oauth2_provider
|
||||
swagger_spec_validator,uritemplate,user_agents,whitenoise,oauth2_provider,packaging
|
||||
known_first_party = drf_yasg,testproj,articles,people,snippets,todo,users,urlconfs
|
||||
|
|
|
|||
Loading…
Reference in New Issue