forked from django-ses/django-ses
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
40 lines (34 loc) · 1.05 KB
/
runtests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
This code provides a mechanism for running django_ses' internal
test suite without having a full Django project. It sets up the
global configuration, then dispatches out to `call_command` to
kick off the test suite.
## The Code
"""
# Setup and configure the minimal settings necessary to
# run the test suite. Note that Django requires that the
# `DATABASES` value be present and configured in order to
# do anything.
from django.conf import settings
settings.configure(
INSTALLED_APPS=[
"django_ses",
],
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
},
MIDDLEWARE_CLASSES=('django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware'),
ROOT_URLCONF='django_ses.tests.test_urls',
)
import django
try:
django.setup()
except AttributeError:
pass
# Start the test suite now that the settings are configured.
from django.core.management import call_command
call_command("test", "django_ses")