diff --git a/.travis.yml b/.travis.yml index f89e77531..7266df2d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 } diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt index a33248d10..14957a531 100644 --- a/requirements/requirements-optionals.txt +++ b/requirements/requirements-optionals.txt @@ -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 diff --git a/tests/conftest.py b/tests/conftest.py index ac29e4a42..d28edeb8a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -67,19 +67,22 @@ def pytest_configure(config): ) # guardian is optional - try: - import guardian # NOQA - except ImportError: - pass - else: - settings.ANONYMOUS_USER_ID = -1 - settings.AUTHENTICATION_BACKENDS = ( - 'django.contrib.auth.backends.ModelBackend', - 'guardian.backends.ObjectPermissionBackend', - ) - settings.INSTALLED_APPS += ( - 'guardian', - ) + # 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: + pass + else: + settings.ANONYMOUS_USER_ID = -1 + settings.AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', + 'guardian.backends.ObjectPermissionBackend', + ) + settings.INSTALLED_APPS += ( + 'guardian', + ) if config.getoption('--no-pkgroot'): sys.path.pop(0) diff --git a/tests/test_relations.py b/tests/test_relations.py index 86ed623ae..9f05e3b31 100644 --- a/tests/test_relations.py +++ b/tests/test_relations.py @@ -145,9 +145,12 @@ class TestProxiedPrimaryKeyRelatedField(APISimpleTestCase): assert representation == self.instance.pk.int -@override_settings(ROOT_URLCONF=[ +urlpatterns = [ url(r'^example/(?P.+)/$', lambda: None, name='example'), -]) +] + + +@override_settings(ROOT_URLCONF='tests.test_relations') class TestHyperlinkedRelatedField(APISimpleTestCase): def setUp(self): self.queryset = MockQueryset([ diff --git a/tox.ini b/tox.ini index 587c469b1..1153eae29 100644 --- a/tox.ini +++ b/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