Skip to content

Commit e361af4

Browse files
jpicdulacp
authored andcommitted
Django 2.0 ImportError fix (pytest-dev#518)
1 parent 352b7df commit e361af4

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
@@ -446,7 +446,11 @@ def _django_set_urlconf(request):
446446
if marker:
447447
skip_if_no_django()
448448
import django.conf
449-
from django.core.urlresolvers import clear_url_caches, set_urlconf
449+
try:
450+
from django.urls import clear_url_caches, set_urlconf
451+
except ImportError:
452+
# Removed in Django 2.0
453+
from django.core.urlresolvers import clear_url_caches, set_urlconf
450454

451455
validate_urls(marker)
452456
original_urlconf = django.conf.settings.ROOT_URLCONF

0 commit comments

Comments
 (0)