-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
45 lines (27 loc) · 1002 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
38
39
40
41
42
43
44
45
#!/usr/bin/env python
import os
import sys
import argparse
import cProfile
from argparse import RawTextHelpFormatter
import pytest
PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
def exit_on_failure(ret, message=None):
if ret:
sys.exit(ret)
description = """
Run unit tests for Proven.
Usage: ./runtests.py [--ds=med_social.settings] [options py.test]
"""
parser = argparse.ArgumentParser(description=description, formatter_class=RawTextHelpFormatter)
parser.add_argument('--ds', metavar='settings', default='med_social.settings.test',
help='Django settings')
if __name__ == '__main__':
args = sys.argv[1:]
parsed, pytest_arguments = parser.parse_known_args(args)
pytest_arguments.append('--nomigrations')
pytest_arguments.extend(['--ds', parsed.ds])
path_to_run = ['./apps', './med_social']
pytest_arguments = path_to_run + pytest_arguments
ret_code = pytest.main(pytest_arguments)
exit_on_failure(ret_code)