mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 01:26:53 +03:00
Django 3 compat (#7058)
* First pass at Django 3.0 compat * Drop Guardian for 1.11 tests, since we're installing an incompatible version * Fix ROOT_URLCONF override in test case * Fix typo Co-Authored-By: Rémy HUBSCHER <hubscher.remy@gmail.com> * Linting
This commit is contained in:
parent
fe840a34ff
commit
7fbbfe2c60
|
@ -14,13 +14,16 @@ matrix:
|
|||
- { python: "3.6", env: DJANGO=2.0 }
|
||||
- { python: "3.6", env: DJANGO=2.1 }
|
||||
- { python: "3.6", env: DJANGO=2.2 }
|
||||
- { python: "3.6", env: DJANGO=3.0 }
|
||||
- { python: "3.6", env: DJANGO=master }
|
||||
|
||||
- { python: "3.7", env: DJANGO=2.0 }
|
||||
- { python: "3.7", env: DJANGO=2.1 }
|
||||
- { python: "3.7", env: DJANGO=2.2 }
|
||||
- { python: "3.7", env: DJANGO=3.0 }
|
||||
- { python: "3.7", env: DJANGO=master }
|
||||
|
||||
- { python: "3.8", env: DJANGO=3.0 }
|
||||
- { python: "3.8", env: DJANGO=master }
|
||||
|
||||
- { python: "3.8", env: TOXENV=base }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
psycopg2-binary>=2.8.2, <2.9
|
||||
markdown==3.1.1
|
||||
pygments==2.4.2
|
||||
django-guardian==1.5.0
|
||||
django-guardian==2.1.0
|
||||
django-filter>=2.2.0, <2.3
|
||||
coreapi==2.3.1
|
||||
coreschema==0.0.4
|
||||
|
|
|
@ -67,6 +67,9 @@ def pytest_configure(config):
|
|||
)
|
||||
|
||||
# guardian is optional
|
||||
# Note that for the test cases we're installing a version of django-guardian
|
||||
# that's only compatible with Django 2.0+.
|
||||
if django.VERSION >= (2, 0, 0):
|
||||
try:
|
||||
import guardian # NOQA
|
||||
except ImportError:
|
||||
|
|
|
@ -145,9 +145,12 @@ class TestProxiedPrimaryKeyRelatedField(APISimpleTestCase):
|
|||
assert representation == self.instance.pk.int
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF=[
|
||||
urlpatterns = [
|
||||
url(r'^example/(?P<name>.+)/$', lambda: None, name='example'),
|
||||
])
|
||||
]
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF='tests.test_relations')
|
||||
class TestHyperlinkedRelatedField(APISimpleTestCase):
|
||||
def setUp(self):
|
||||
self.queryset = MockQueryset([
|
||||
|
|
3
tox.ini
3
tox.ini
|
@ -4,6 +4,7 @@ envlist =
|
|||
{py35,py36,py37}-django20,
|
||||
{py35,py36,py37}-django21
|
||||
{py35,py36,py37}-django22
|
||||
{py36,py37,py38}-django30,
|
||||
{py36,py37,py38}-djangomaster,
|
||||
base,dist,lint,docs,
|
||||
|
||||
|
@ -13,6 +14,7 @@ DJANGO =
|
|||
2.0: django20
|
||||
2.1: django21
|
||||
2.2: django22
|
||||
3.0: django30
|
||||
master: djangomaster
|
||||
|
||||
[testenv]
|
||||
|
@ -26,6 +28,7 @@ deps =
|
|||
django20: Django>=2.0,<2.1
|
||||
django21: Django>=2.1,<2.2
|
||||
django22: Django>=2.2,<3.0
|
||||
django30: Django==3.0rc1
|
||||
djangomaster: https://github.com/django/django/archive/master.tar.gz
|
||||
-rrequirements/requirements-testing.txt
|
||||
-rrequirements/requirements-optionals.txt
|
||||
|
|
Loading…
Reference in New Issue
Block a user