Move django bootstrapping to separate file so it can be reused between test modules.

This commit is contained in:
Emil Stenström 2015-06-14 14:16:50 +02:00
parent d3261ca50a
commit 143918e2cf
2 changed files with 13 additions and 10 deletions

View file

@ -0,0 +1,12 @@
import django
from django.conf import settings
if not settings.configured:
settings.configure(
INSTALLED_APPS=('django_components',),
TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ["tests/templates/"],
}]
)
django.setup()

View file

@ -1,16 +1,7 @@
from textwrap import dedent
import unittest
import django
from django.conf import settings
from django_components import component
settings.configure(
TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ["tests/templates/"],
}]
)
django.setup()
from .django_test_setup import * # NOQA
class SimpleComponent(component.Component):
def context(self, variable=None):