forked from marcgibbons/django-rest-swagger
-
Notifications
You must be signed in to change notification settings - Fork 2
/
runtests.py
executable file
·27 lines (25 loc) · 1017 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
#!/usr/bin/env python
import os
import sys
if '--lintonly' in sys.argv:
import subprocess
FLAKE8_ARGS = ['rest_framework_swagger', 'tests', '--ignore=E501', 'docs']
def exit_on_failure(ret, message=None):
if ret:
sys.exit(ret)
def flake8_main(args):
print('Running flake8 code linting')
ret = subprocess.call(['flake8'] + args)
print('flake8 failed' if ret else 'flake8 passed')
return ret
exit_on_failure(flake8_main(FLAKE8_ARGS))
else:
from django.core.management import execute_from_command_line
sys.path.append("./tests/cigar_example")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cigar_example.settings")
import django.conf as conf
conf.settings.NOSE_ARGS[-1] = 'rest_framework_swagger'
execute_from_command_line([sys.argv[0], "test"])
sys.path.append("./tests/auth_example")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "auth_example.settings")
execute_from_command_line([sys.argv[0], "test"])