diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bace820..5825210 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ exclude: tests/etc/user-* repos: - repo: https://github.com/PyCQA/bandit - rev: 1.7.10 + rev: 1.8.2 hooks: - id: bandit args: diff --git a/edc_document_status/tests/test_settings.py b/edc_document_status/tests/test_settings.py new file mode 100644 index 0000000..16928dc --- /dev/null +++ b/edc_document_status/tests/test_settings.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +import sys +from pathlib import Path + +from edc_test_settings.default_test_settings import DefaultTestSettings + +app_name = "edc_document_status" +base_dir = Path(__file__).absolute().parent.parent.parent + +project_settings = DefaultTestSettings( + calling_file=__file__, + BASE_DIR=base_dir, + APP_NAME=app_name, + SUBJECT_VISIT_MODEL="edc_visit_tracking.subjectvisit", + INSTALLED_APPS=[ + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.messages", + "django.contrib.sessions", + "django.contrib.sites", + "django.contrib.staticfiles", + "django_crypto_fields.apps.AppConfig", + "django_revision.apps.AppConfig", + "multisite", + "edc_document_status.apps.AppConfig", + ], + add_dashboard_middleware=True, +).settings + +for k, v in project_settings.items(): + setattr(sys.modules[__name__], k, v) diff --git a/runtests.py b/runtests.py index 85710c3..76820be 100644 --- a/runtests.py +++ b/runtests.py @@ -1,38 +1,5 @@ #!/usr/bin/env python -import logging -from pathlib import Path - -from edc_test_utils import DefaultTestSettings, func_main - -app_name = "edc_document_status" -base_dir = Path(__file__).absolute().parent - -project_settings = DefaultTestSettings( - calling_file=__file__, - BASE_DIR=base_dir, - APP_NAME=app_name, - SUBJECT_VISIT_MODEL="edc_visit_tracking.subjectvisit", - INSTALLED_APPS=[ - "django.contrib.admin", - "django.contrib.auth", - "django.contrib.contenttypes", - "django.contrib.messages", - "django.contrib.sessions", - "django.contrib.sites", - "django.contrib.staticfiles", - "django_crypto_fields.apps.AppConfig", - "django_revision.apps.AppConfig", - "multisite", - "edc_document_status.apps.AppConfig", - ], - add_dashboard_middleware=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_document_status.tests.test_settings", "edc_document_status.tests")