-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruntests.py
49 lines (41 loc) · 1.27 KB
/
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
46
47
48
49
#!/usr/bin/env python
import django
import logging
import os
import sys
from django.conf import settings
from django.test.runner import DiscoverRunner
from edc_test_utils import DefaultTestSettings
from os.path import abspath, dirname
app_name = 'ambition_lists'
base_dir = dirname(abspath(__file__))
DEFAULT_SETTINGS = DefaultTestSettings(
calling_file=__file__,
APP_NAME=app_name,
BASE_DIR=base_dir,
ETC_DIR=os.path.join(base_dir, app_name, "tests", "etc"),
ADVERSE_EVENT_ADMIN_SITE="ambition_ae_admin",
ADVERSE_EVENT_APP_LABEL="ambition_ae",
INSTALLED_APPS=[
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
"ambition_lists.apps.AppConfig",
],
# add_dashboard_middleware=True,
# use_test_urls=True,
).settings
def main():
if not settings.configured:
settings.configure(**DEFAULT_SETTINGS)
django.setup()
tags = [t.split('=')[1] for t in sys.argv if t.startswith('--tag')]
failures = DiscoverRunner(failfast=False, tags=tags).run_tests(
[f'{app_name}.tests'])
sys.exit(failures)
if __name__ == "__main__":
logging.basicConfig()
main()