forked from kpn/django-etcd-settings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
42 lines (35 loc) · 1.12 KB
/
tests.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
import sys
def run_tests():
import django
from django.conf import settings, global_settings
settings.configure(
# Minimal django settings
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'TEST_NAME': ':memory:',
},
},
MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES,
INSTALLED_APPS=['etcd_settings'],
DJES_DEV_PARAMS=None,
DJES_REQUEST_GETTER=None,
DJES_ENV='dev',
DJES_ETCD_DETAILS=None,
DJES_WSGI_FILE=None
# DJES_ETCD_DETAILS=dict(host='localhost', port=4000, protocol='http',
# prefix='/config/my-django-app')
)
if hasattr(django, 'setup'):
django.setup()
try:
from django.test.runner import DiscoverRunner as Runner
except ImportError:
from django.test.simple import DjangoTestSuiteRunner as Runner
test_runner = Runner(verbosity=1)
return test_runner.run_tests(['tests'])
def main():
failures = run_tests()
sys.exit(failures)
if __name__ == '__main__':
main()