forked from ambition-study/ambition-ae
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
104 lines (96 loc) · 3.54 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/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, join
app_name = 'ambition_ae'
base_dir = dirname(abspath(__file__))
DEFAULT_SETTINGS = DefaultTestSettings(
calling_file=__file__,
BASE_DIR=base_dir,
APP_NAME=app_name,
ETC_DIR=os.path.join(base_dir, app_name, "tests", "etc"),
SUBJECT_VISIT_MODEL="ambition_subject.subjectvisit",
ADVERSE_EVENT_APP_LABEL="ambition_ae",
ADVERSE_EVENT_ADMIN_SITE="ambition_ae_admin",
DASHBOARD_URL_NAMES={
'subject_listboard_url': 'edc_subject_dashboard:subject_listboard_url',
'subject_dashboard_url': 'edc_subject_dashboard:subject_dashboard_url',
},
EDC_BOOTSTRAP=3,
EMAIL_BACKEND="django.core.mail.backends.locmem.EmailBackend",
EMAIL_CONTACTS={
"data_request": "someone@example.com",
"data_manager": "someone@example.com",
"tmg": "someone@example.com",
},
EMAIL_ENABLED=True,
HOLIDAY_FILE=join(base_dir, app_name, "tests", "holidays.csv"),
LIVE_SYSTEM=False,
EDC_RANDOMIZATION_LIST_MODEL="ambition_rando.randomizationlist",
EDC_RANDOMIZATION_LIST_PATH=join(base_dir, app_name, "tests", "etc"),
INSTALLED_APPS=[
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
"django_crypto_fields.apps.AppConfig",
"django_revision.apps.AppConfig",
"django_collect_offline.apps.AppConfig",
"django_collect_offline_files.apps.AppConfig",
"rest_framework",
"rest_framework.authtoken",
"edc_action_item.apps.AppConfig",
"edc_adverse_event.apps.AppConfig",
"edc_appointment.apps.AppConfig",
"edc_auth.apps.AppConfig",
"edc_consent.apps.AppConfig",
"edc_dashboard.apps.AppConfig",
"edc_data_manager.apps.AppConfig",
"edc_device.apps.AppConfig",
"edc_identifier.apps.AppConfig",
"edc_lab.apps.AppConfig",
"edc_list_data.apps.AppConfig",
"edc_metadata.apps.AppConfig",
"edc_notification.apps.AppConfig",
"edc_offstudy.apps.AppConfig",
"edc_prn.apps.AppConfig",
'edc_randomization.apps.AppConfig',
"edc_registration.apps.AppConfig",
"edc_sites.apps.AppConfig",
"edc_subject_dashboard.apps.AppConfig",
"edc_timepoint.apps.AppConfig",
"edc_visit_schedule.apps.AppConfig",
"edc_visit_tracking.apps.AppConfig",
"ambition_visit_schedule.apps.AppConfig",
"ambition_labs.apps.AppConfig",
"ambition_subject.apps.AppConfig",
"ambition_screening.apps.AppConfig",
"ambition_lists.apps.AppConfig",
"ambition_rando.apps.AppConfig",
"ambition_prn.apps.AppConfig",
"ambition_ae.apps.EdcProtocolAppConfig",
"ambition_ae.apps.EdcFacilityAppConfig",
"ambition_ae.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()