mirror of
https://github.com/django-components/django-components.git
synced 2025-08-04 06:18:17 +00:00
Move django bootstrapping to separate file so it can be reused between test modules.
This commit is contained in:
parent
d3261ca50a
commit
143918e2cf
2 changed files with 13 additions and 10 deletions
12
tests/django_test_setup.py
Normal file
12
tests/django_test_setup.py
Normal 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()
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue