Skip to content

Commit cc3d52a

Browse files
author
Pamela McA'Nulty
authored
Merge pull request #33 from PamelaM/pm/defer_reading_settings
Defer check for valid django.template.backends.django.DjangoTemplates
2 parents b9e9d00 + 9283084 commit cc3d52a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

django_coverage_plugin/plugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,13 @@ def check_debug():
5353
# Django 1.8+ handles both old and new-style settings and converts them
5454
# into template engines, so we don't need to depend on settings values
5555
# directly and can look at the resulting configured objects
56+
57+
# django.template.backends.django gets loaded lazily, so return false
58+
# until they've been loaded
59+
if not hasattr(django.template, "backends"):
60+
return False
5661
if not hasattr(django.template.backends, "django"):
57-
raise DjangoTemplatePluginException("Can't use non-Django templates.")
62+
return False
5863

5964
if not hasattr(django.template.backends.django, "DjangoTemplates"):
6065
raise DjangoTemplatePluginException("Can't use non-Django templates.")

0 commit comments

Comments
 (0)