forked from adamchainz/django-cors-headers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
41 lines (34 loc) · 958 Bytes
/
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
#!/usr/bin/env python
"""
"""
import sys
def run_tests():
import django
from django.conf import global_settings
from django.conf import settings
settings.configure(
INSTALLED_APPS=[
'corsheaders',
],
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'TEST_NAME': ':memory:',
},
},
MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES + (
'corsheaders.middleware.CorsMiddleware',),
)
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(['corsheaders'])
def main():
failures = run_tests()
sys.exit(failures)
if __name__ == '__main__':
main()