-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathruntests.py
More file actions
executable file
·41 lines (28 loc) · 878 Bytes
/
runtests.py
File metadata and controls
executable file
·41 lines (28 loc) · 878 Bytes
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 os
import sys
import optparse
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")
def parse_args():
parser = optparse.OptionParser()
args = parser.parse_args()[1]
# NOTE: When the test mode is called from setup.py
try:
args.remove('test')
except ValueError:
pass
return args or ['app', 'hstore_flattenfields']
def configure_settings():
from django.conf import settings
return settings
def get_runner(settings):
from django.test.utils import get_runner
TestRunner = get_runner(settings)
return TestRunner(verbosity=1, interactive=True, failfast=False)
def runtests():
test_labels = parse_args()
settings = configure_settings()
runner = get_runner(settings)
sys.exit(runner.run_tests(test_labels))
if __name__ == '__main__':
runtests()