-
Notifications
You must be signed in to change notification settings - Fork 18
/
runtests.py
37 lines (31 loc) · 936 Bytes
/
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
import sys
import pytest
from django.conf import settings
def run_tests():
if not settings.configured:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
}
settings.configure(
DATABASES=DATABASES,
REST_FRAMEWORK = {
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
'rest_framework.renderers.BrowsableAPIRenderer',
),
},
INSTALLED_APPS=(
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.sessions',
),
MIDDLEWARE=[],
SECRET_KEY='1234',
)
return pytest.main()
if __name__ == '__main__':
sys.exit(run_tests())