From 66b0be5cf9670d2701d153d27a182c8efe9d5897 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Tue, 17 Sep 2024 16:11:40 +0100 Subject: [PATCH] Fix/update test settings --- edc_consent/tests/test_settings.py | 31 +++++++++++++++--------------- runtests.py | 19 ++---------------- 2 files changed, 17 insertions(+), 33 deletions(-) diff --git a/edc_consent/tests/test_settings.py b/edc_consent/tests/test_settings.py index a99992f..22d9557 100644 --- a/edc_consent/tests/test_settings.py +++ b/edc_consent/tests/test_settings.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python import sys from pathlib import Path @@ -6,13 +7,11 @@ from edc_utils import get_utcnow app_name = "edc_consent" -base_dir = Path(__file__).absolute().parent +base_dir = Path(__file__).absolute().parent.parent.parent project_settings = DefaultTestSettings( calling_file=__file__, BASE_DIR=base_dir, - DJANGO_CRYPTO_FIELDS_KEY_PATH=base_dir / "crypto_keys", - GIT_DIR=base_dir.parent.parent, APP_NAME=app_name, SILENCED_SYSTEM_CHECKS=[ "edc_consent.E001", @@ -21,17 +20,16 @@ "edc_navbar.E003", "edc_sites.E001", ], - ETC_DIR=str(base_dir / app_name / "tests" / "etc"), EDC_NAVBAR_DEFAULT="edc_consent", EDC_PROTOCOL_STUDY_OPEN_DATETIME=get_utcnow() - relativedelta(years=1), EDC_PROTOCOL_STUDY_CLOSE_DATETIME=get_utcnow() + relativedelta(years=1), - EDC_SITES_REGISTER_DEFAULT=True, SUBJECT_SCREENING_MODEL="consent_app.subjectscreening", SUBJECT_CONSENT_MODEL="consent_app.subjectconsent", SUBJECT_VISIT_MODEL="consent_app.subjectvisit", SUBJECT_VISIT_MISSED_MODEL="consent_app.subjectvisitmissed", SUBJECT_REQUISITION_MODEL="consent_app.subjectrequisition", SUBJECT_REFUSAL_MODEL="consent_app.subjectrefusal", + EDC_SITES_REGISTER_DEFAULT=True, INSTALLED_APPS=[ "django.contrib.admin", "django.contrib.auth", @@ -40,30 +38,31 @@ "django.contrib.messages", "django.contrib.staticfiles", "django.contrib.sites", - "multisite", - "simple_history", "django_crypto_fields.apps.AppConfig", "django_revision.apps.AppConfig", + "multisite", + "adverse_event_app.apps.AppConfig", + "edc_action_item.apps.AppConfig", + "edc_adverse_event.apps.AppConfig", "edc_appointment.apps.AppConfig", - "edc_visit_schedule.apps.AppConfig", - "edc_export.apps.AppConfig", + "edc_auth.apps.AppConfig", "edc_crf.apps.AppConfig", - "edc_sites.apps.AppConfig", - "edc_form_runners.apps.AppConfig", - "edc_timepoint.apps.AppConfig", + "edc_dashboard.apps.AppConfig", "edc_data_manager.apps.AppConfig", "edc_device.apps.AppConfig", + "edc_form_runners.apps.AppConfig", "edc_identifier.apps.AppConfig", - "edc_action_item.apps.AppConfig", "edc_lab.apps.AppConfig", - "edc_locator.apps.AppConfig", "edc_metadata.apps.AppConfig", "edc_notification.apps.AppConfig", - "edc_protocol.apps.AppConfig", "edc_registration.apps.AppConfig", + "edc_review_dashboard.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", "edc_consent.apps.AppConfig", - "edc_auth.apps.AppConfig", "consent_app.apps.AppConfig", "edc_appconfig.apps.AppConfig", ], diff --git a/runtests.py b/runtests.py index 851d6b2..57f333e 100644 --- a/runtests.py +++ b/runtests.py @@ -1,20 +1,5 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- - - -import os -import sys +from edc_test_settings.func_main import func_main2 if __name__ == "__main__": - os.environ["DJANGO_SETTINGS_MODULE"] = "edc_consent.tests.test_settings" - import django - - django.setup() - from django.test.runner import DiscoverRunner - - tags = [t.split("=")[1] for t in sys.argv if t.startswith("--tag")] - failfast = any([True for t in sys.argv if t.startswith("--failfast")]) - keepdb = any([True for t in sys.argv if t.startswith("--keepdb")]) - opts = dict(failfast=failfast, tags=tags, keepdb=keepdb) - failures = DiscoverRunner(**opts).run_tests(["edc_consent.tests"], **opts) - sys.exit(failures) + func_main2("edc_consent.tests.test_settings", "edc_consent.tests")