forked from voronind/django-url-robots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruntests.py
51 lines (42 loc) · 1.33 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
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
import sys
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
'url_robots',
],
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3'
}
},
ROOT_URLCONF='tests.test_utils.urls',
SITE_ID=1,
MIDDLEWARE_CLASSES=[
'django.middleware.http.ConditionalGetMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
],
)
def runtests():
import django
from django.conf import settings
# Compatibility with Django 1.7's stricter initialization
if not settings.configured:
settings.configure(**DEFAULT_SETTINGS)
if hasattr(django, 'setup'):
django.setup()
from django.test.runner import DiscoverRunner
test_args = ['url_robots.tests']
failures = DiscoverRunner(
verbosity=1, interactive=True, failfast=False
).run_tests(test_args)
sys.exit(failures)
if __name__ == '__main__':
runtests()