From 1a14310c512e36f71dedb992f54a621d1feaef33 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 13 Nov 2024 13:11:01 +0000 Subject: [PATCH 1/2] Fix test runner --- runtests.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runtests.py b/runtests.py index c3db6f7..144311c 100644 --- a/runtests.py +++ b/runtests.py @@ -51,8 +51,11 @@ "edc_appointment.apps.AppConfig", "edc_auth.apps.AppConfig", "edc_action_item.apps.AppConfig", + "edc_adverse_event.apps.AppConfig", + "adverse_event_app.apps.AppConfig", "edc_consent.apps.AppConfig", "edc_data_manager.apps.AppConfig", + "edc_dashboard.apps.AppConfig", "edc_device.apps.AppConfig", "edc_identifier.apps.AppConfig", "edc_facility.apps.AppConfig", @@ -60,7 +63,9 @@ "edc_metadata.apps.AppConfig", "edc_notification.apps.AppConfig", "edc_registration.apps.AppConfig", + "edc_review_dashboard.apps.AppConfig", "edc_sites.apps.AppConfig", + "edc_subject_dashboard.apps.AppConfig", "edc_visit_schedule.apps.AppConfig", "edc_visit_tracking.apps.AppConfig", "edc_timepoint.apps.AppConfig", From 7da5be9935a28a16c8c1863b198fab83d9368266 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 13 Nov 2024 13:23:49 +0000 Subject: [PATCH 2/2] Update test runner --- edc_form_runners/tests/test_settings.py | 78 +++++++++++++++++++++++ runtests.py | 85 +------------------------ 2 files changed, 80 insertions(+), 83 deletions(-) create mode 100644 edc_form_runners/tests/test_settings.py diff --git a/edc_form_runners/tests/test_settings.py b/edc_form_runners/tests/test_settings.py new file mode 100644 index 0000000..179caf3 --- /dev/null +++ b/edc_form_runners/tests/test_settings.py @@ -0,0 +1,78 @@ +import sys +from datetime import datetime +from pathlib import Path +from zoneinfo import ZoneInfo + +from dateutil.relativedelta import relativedelta +from edc_test_settings.default_test_settings import DefaultTestSettings + +app_name = "edc_form_runners" +base_dir = Path(__file__).absolute().parent.parent.parent + +project_settings = DefaultTestSettings( + calling_file=__file__, + BASE_DIR=base_dir, + APP_NAME=app_name, + ETC_DIR=base_dir / app_name / "tests" / "etc", + SILENCED_SYSTEM_CHECKS=[ + "sites.E101", + "edc_navbar.E002", + "edc_navbar.E003", + "edc_sites.E001", + ], + EDC_NAVBAR_DEFAULT="form_runners_app", + EDC_AUTH_CODENAMES_WARN_ONLY=True, + EDC_AUTH_SKIP_SITE_AUTHS=True, + EDC_AUTH_SKIP_AUTH_UPDATER=True, + SUBJECT_VISIT_MODEL="edc_visit_tracking.subjectvisit", + SUBJECT_VISIT_MISSED_MODEL="edc_visit_tracking.subjectvisitmissed", + SUBJECT_SCREENING_MODEL="form_runners_app.subjectscreening", + EDC_SITES_REGISTER_DEFAULT=False, + ROOT_URLCONF="form_runners_app.urls", + EDC_PROTOCOL_STUDY_OPEN_DATETIME=( + datetime(2018, 5, 15, 0, 0, 0, tzinfo=ZoneInfo("UTC")) - relativedelta(years=1) + ), + EDC_PROTOCOL_STUDY_CLOSE_DATETIME=( + datetime(2022, 5, 14, 0, 0, 0, tzinfo=ZoneInfo("UTC")) - relativedelta(years=1) + ), + 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", + "edc_appointment.apps.AppConfig", + "edc_auth.apps.AppConfig", + "edc_action_item.apps.AppConfig", + "edc_adverse_event.apps.AppConfig", + "adverse_event_app.apps.AppConfig", + "edc_consent.apps.AppConfig", + "edc_data_manager.apps.AppConfig", + "edc_dashboard.apps.AppConfig", + "edc_device.apps.AppConfig", + "edc_identifier.apps.AppConfig", + "edc_facility.apps.AppConfig", + "edc_lab.apps.AppConfig", + "edc_metadata.apps.AppConfig", + "edc_notification.apps.AppConfig", + "edc_registration.apps.AppConfig", + "edc_review_dashboard.apps.AppConfig", + "edc_sites.apps.AppConfig", + "edc_subject_dashboard.apps.AppConfig", + "edc_visit_schedule.apps.AppConfig", + "edc_visit_tracking.apps.AppConfig", + "edc_timepoint.apps.AppConfig", + "edc_form_runners.apps.AppConfig", + "form_runners_app.apps.AppConfig", + "edc_appconfig.apps.AppConfig", + ], + add_dashboard_middleware=True, + use_test_urls=True, +).settings + +for k, v in project_settings.items(): + setattr(sys.modules[__name__], k, v) diff --git a/runtests.py b/runtests.py index 144311c..b2fa954 100644 --- a/runtests.py +++ b/runtests.py @@ -1,87 +1,6 @@ #!/usr/bin/env python -import logging -from datetime import datetime -from pathlib import Path -from zoneinfo import ZoneInfo - -from dateutil.relativedelta import relativedelta -from edc_test_utils import DefaultTestSettings, func_main - -app_name = "edc_form_runners" -base_dir = Path(__file__).absolute().parent - -project_settings = DefaultTestSettings( - calling_file=__file__, - APP_NAME=app_name, - BASE_DIR=base_dir, - ETC_DIR=str(base_dir / app_name / "tests" / "etc"), - SILENCED_SYSTEM_CHECKS=[ - "sites.E101", - "edc_navbar.E002", - "edc_navbar.E003", - "edc_sites.E001", - ], - EDC_NAVBAR_DEFAULT="form_runners_app", - EDC_AUTH_CODENAMES_WARN_ONLY=True, - EDC_AUTH_SKIP_SITE_AUTHS=True, - EDC_AUTH_SKIP_AUTH_UPDATER=True, - SUBJECT_VISIT_MODEL="edc_visit_tracking.subjectvisit", - SUBJECT_VISIT_MISSED_MODEL="edc_visit_tracking.subjectvisitmissed", - # SUBJECT_REQUISITION_MODEL=f"{self.app_name}.subjectrequisition", - # SUBJECT_REFUSAL_MODEL=f"{self.app_name}.subjectrefusal", - SUBJECT_SCREENING_MODEL="form_runners_app.subjectscreening", - EDC_SITES_REGISTER_DEFAULT=False, - ROOT_URLCONF="form_runners_app.urls", - EDC_PROTOCOL_STUDY_OPEN_DATETIME=( - datetime(2018, 5, 15, 0, 0, 0, tzinfo=ZoneInfo("UTC")) - relativedelta(years=1) - ), - EDC_PROTOCOL_STUDY_CLOSE_DATETIME=( - datetime(2022, 5, 14, 0, 0, 0, tzinfo=ZoneInfo("UTC")) - relativedelta(years=1) - ), - 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", - "edc_appointment.apps.AppConfig", - "edc_auth.apps.AppConfig", - "edc_action_item.apps.AppConfig", - "edc_adverse_event.apps.AppConfig", - "adverse_event_app.apps.AppConfig", - "edc_consent.apps.AppConfig", - "edc_data_manager.apps.AppConfig", - "edc_dashboard.apps.AppConfig", - "edc_device.apps.AppConfig", - "edc_identifier.apps.AppConfig", - "edc_facility.apps.AppConfig", - "edc_lab.apps.AppConfig", - "edc_metadata.apps.AppConfig", - "edc_notification.apps.AppConfig", - "edc_registration.apps.AppConfig", - "edc_review_dashboard.apps.AppConfig", - "edc_sites.apps.AppConfig", - "edc_subject_dashboard.apps.AppConfig", - "edc_visit_schedule.apps.AppConfig", - "edc_visit_tracking.apps.AppConfig", - "edc_timepoint.apps.AppConfig", - "edc_form_runners.apps.AppConfig", - "form_runners_app.apps.AppConfig", - "edc_appconfig.apps.AppConfig", - ], - add_dashboard_middleware=True, - use_test_urls=True, -).settings - - -def main(): - func_main(project_settings, f"{app_name}.tests") +from edc_test_settings.func_main import func_main2 if __name__ == "__main__": - logging.basicConfig() - main() + func_main2("edc_form_runners.tests.test_settings", "edc_form_runners.tests")