Skip to content

Commit 84c27a0

Browse files
jpicblueyed
authored andcommitted
Django 2.0 ImportError fix (#518)
1 parent 97c6831 commit 84c27a0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pytest_django/plugin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,11 @@ def _django_set_urlconf(request):
441441
if marker:
442442
skip_if_no_django()
443443
import django.conf
444-
from django.core.urlresolvers import clear_url_caches, set_urlconf
444+
try:
445+
from django.urls import clear_url_caches, set_urlconf
446+
except ImportError:
447+
# Removed in Django 2.0
448+
from django.core.urlresolvers import clear_url_caches, set_urlconf
445449

446450
validate_urls(marker)
447451
original_urlconf = django.conf.settings.ROOT_URLCONF

0 commit comments

Comments
 (0)