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_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_chol_model_mixin.py b/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_chol_model_mixin.py
index ec7ad34..5259880 100644
--- a/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_chol_model_mixin.py
+++ b/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_chol_model_mixin.py
@@ -1,5 +1,6 @@
from django.db import models
from django.utils.html import format_html
+from django.utils.safestring import mark_safe
from edc_constants.choices import YES_NO_NA
from edc_constants.constants import NOT_APPLICABLE
from edc_model import models as edc_models
@@ -14,10 +15,13 @@ class ClinicalReviewCholModelMixin(models.Model):
choices=YES_NO_NA,
default=NOT_APPLICABLE,
help_text=format_html(
- "Note: Select `not applicable` if diagnosis previously reported.
"
- "`Since last seen` includes today.
"
- "If `yes', complete the initial review CRF
"
- "If `not applicable`, complete the review CRF."
+ "{}",
+ mark_safe(
+ "Note: Select `not applicable` if diagnosis previously reported.
"
+ "`Since last seen` includes today.
"
+ "If `yes', complete the initial review CRF
"
+ "If `not applicable`, complete the review CRF."
+ ), # nosec B308, B703
),
)
@@ -38,7 +42,7 @@ class ClinicalReviewCholModelMixin(models.Model):
chol_dx = models.CharField(
verbose_name=format_html(
- "As of today, was the patient newly diagnosed with high cholesterol?"
+ "As of today, was the patient {} diagnosed with high cholesterol?", "newly"
),
max_length=15,
choices=YES_NO_NA,
diff --git a/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_dm_model_mixin.py b/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_dm_model_mixin.py
index e793266..d8c8ed9 100644
--- a/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_dm_model_mixin.py
+++ b/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_dm_model_mixin.py
@@ -1,5 +1,6 @@
from django.db import models
from django.utils.html import format_html
+from django.utils.safestring import mark_safe
from edc_constants.choices import YES_NO_NA
from edc_constants.constants import NOT_APPLICABLE
from edc_model import models as edc_models
@@ -14,10 +15,13 @@ class ClinicalReviewDmModelMixin(models.Model):
choices=YES_NO_NA,
default=NOT_APPLICABLE,
help_text=format_html(
- "Note: Select `not applicable` if diagnosis previously reported.
"
- "`Since last seen` includes today.
"
- "If `yes', complete the initial review CRF
"
- "If `not applicable`, complete the review CRF."
+ "{}",
+ mark_safe(
+ "Note: Select `not applicable` if diagnosis previously reported.
"
+ "`Since last seen` includes today.
"
+ "If `yes', complete the initial review CRF
"
+ "If `not applicable`, complete the review CRF."
+ ), # nosec B308, B703
),
)
@@ -38,7 +42,7 @@ class ClinicalReviewDmModelMixin(models.Model):
dm_dx = models.CharField(
verbose_name=format_html(
- "As of today, was the patient newly diagnosed with diabetes?"
+ "As of today, was the patient {} diagnosed with diabetes?", "newly"
),
max_length=15,
choices=YES_NO_NA,
diff --git a/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_hiv_model_mixin.py b/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_hiv_model_mixin.py
index ee4d72e..5ca33cf 100644
--- a/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_hiv_model_mixin.py
+++ b/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_hiv_model_mixin.py
@@ -1,5 +1,6 @@
from django.db import models
from django.utils.html import format_html
+from django.utils.safestring import mark_safe
from edc_constants.choices import YES_NO_NA
from edc_constants.constants import NOT_APPLICABLE
from edc_model import models as edc_models
@@ -14,10 +15,13 @@ class ClinicalReviewHivModelMixin(models.Model):
choices=YES_NO_NA,
default=NOT_APPLICABLE,
help_text=format_html(
- "Note: Select `not applicable` if diagnosis previously reported.
"
- "`Since last seen` includes today.
"
- "If `yes', complete the initial review CRF
"
- "If `not applicable`, complete the review CRF."
+ "{}",
+ mark_safe(
+ "Note: Select `not applicable` if diagnosis previously reported.
"
+ "`Since last seen` includes today.
"
+ "If `yes', complete the initial review CRF
"
+ "If `not applicable`, complete the review CRF."
+ ), # nosec B308, B703
),
)
@@ -38,7 +42,7 @@ class ClinicalReviewHivModelMixin(models.Model):
hiv_dx = models.CharField(
verbose_name=format_html(
- "As of today, was the patient newly diagnosed with HIV infection?"
+ "As of today, was the patient {} diagnosed with HIV infection?", "newly"
),
max_length=15,
choices=YES_NO_NA,
diff --git a/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_htn_model_mixin.py b/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_htn_model_mixin.py
index 606fbd9..d3e7f5d 100644
--- a/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_htn_model_mixin.py
+++ b/edc_dx_review/model_mixins/clinical_review_followup/clinical_review_followup_htn_model_mixin.py
@@ -1,5 +1,6 @@
from django.db import models
from django.utils.html import format_html
+from django.utils.safestring import mark_safe
from edc_constants.choices import YES_NO_NA
from edc_constants.constants import NOT_APPLICABLE
from edc_model import models as edc_models
@@ -14,10 +15,13 @@ class ClinicalReviewHtnModelMixin(models.Model):
choices=YES_NO_NA,
default=NOT_APPLICABLE,
help_text=format_html(
- "Note: Select `not applicable` if diagnosis previously reported.
"
- "`Since last seen` includes today.
"
- "If `yes', complete the initial review CRF
"
- "If `not applicable`, complete the review CRF."
+ "{}",
+ mark_safe(
+ "Note: Select `not applicable` if diagnosis previously reported.
"
+ "`Since last seen` includes today.
"
+ "If `yes', complete the initial review CRF
"
+ "If `not applicable`, complete the review CRF."
+ ), # nosec B308, B703
),
)
@@ -38,7 +42,10 @@ class ClinicalReviewHtnModelMixin(models.Model):
htn_dx = models.CharField(
verbose_name=format_html(
- "As of today, was the patient newly diagnosed with hypertension?"
+ "{}",
+ mark_safe(
+ "As of today, was the patient newly diagnosed with hypertension?"
+ ), # nosec B308, B703
),
max_length=15,
choices=YES_NO_NA,
diff --git a/edc_dx_review/tests/test_settings.py b/edc_dx_review/tests/test_settings.py
new file mode 100644
index 0000000..39592b7
--- /dev/null
+++ b/edc_dx_review/tests/test_settings.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+import sys
+from pathlib import Path
+
+from edc_constants.constants import CHOL, DM, HIV, HTN
+from edc_test_settings.default_test_settings import DefaultTestSettings
+
+app_name = "edc_dx_review"
+
+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",
+ SUBJECT_SCREENING_MODEL="edc_metadata.subjectscreening",
+ SUBJECT_CONSENT_MODEL="edc_metadata.subjectconsent",
+ SUBJECT_VISIT_MODEL="edc_visit_tracking.subjectvisit",
+ SUBJECT_VISIT_MISSED_MODEL="edc_metadata.subjectvisitmissed",
+ SUBJECT_REQUISITION_MODEL="edc_metadata.subjectrequisition",
+ EDC_SITES_REGISTER_DEFAULT=True,
+ LIST_MODEL_APP_LABEL="edc_dx_review",
+ EDC_DX_LABELS={
+ HIV: "HIV",
+ DM: "Diabetes",
+ HTN: "Hypertension",
+ CHOL: "High Cholesterol",
+ },
+ 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",
+ "multisite",
+ "edc_appointment.apps.AppConfig",
+ "edc_action_item.apps.AppConfig",
+ "edc_consent.apps.AppConfig",
+ "edc_device.apps.AppConfig",
+ "edc_facility.apps.AppConfig",
+ "edc_lab.apps.AppConfig",
+ "edc_list_data.apps.AppConfig",
+ "edc_metadata.apps.AppConfig",
+ "edc_crf.apps.AppConfig",
+ "edc_offstudy.apps.AppConfig",
+ "edc_registration.apps.AppConfig",
+ "edc_identifier.apps.AppConfig",
+ "edc_notification.apps.AppConfig",
+ "edc_sites.apps.AppConfig",
+ "edc_timepoint.apps.AppConfig",
+ "edc_visit_schedule.apps.AppConfig",
+ "edc_visit_tracking.apps.AppConfig",
+ "edc_dx_review.apps.AppConfig",
+ ],
+ RANDOMIZATION_LIST_PATH=base_dir / app_name / "tests" / "test_randomization_list.csv",
+ 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 cfab127..f8e3c8f 100644
--- a/runtests.py
+++ b/runtests.py
@@ -1,72 +1,5 @@
#!/usr/bin/env python
-import logging
-from pathlib import Path
-
-from edc_constants.constants import CHOL, DM, HIV, HTN
-from edc_test_utils import DefaultTestSettings, func_main
-
-app_name = "edc_dx_review"
-
-base_dir = Path(__file__).absolute().parent
-
-project_settings = DefaultTestSettings(
- calling_file=__file__,
- BASE_DIR=base_dir,
- APP_NAME=app_name,
- ETC_DIR=str(base_dir / app_name / "tests" / "etc"),
- SUBJECT_SCREENING_MODEL="edc_metadata.subjectscreening",
- SUBJECT_CONSENT_MODEL="edc_metadata.subjectconsent",
- SUBJECT_VISIT_MODEL="edc_visit_tracking.subjectvisit",
- SUBJECT_VISIT_MISSED_MODEL="edc_metadata.subjectvisitmissed",
- SUBJECT_REQUISITION_MODEL="edc_metadata.subjectrequisition",
- EDC_SITES_REGISTER_DEFAULT=True,
- LIST_MODEL_APP_LABEL="edc_dx_review",
- EDC_DX_LABELS={
- HIV: "HIV",
- DM: "Diabetes",
- HTN: "Hypertension",
- CHOL: "High Cholesterol",
- },
- 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",
- "multisite",
- "edc_appointment.apps.AppConfig",
- "edc_action_item.apps.AppConfig",
- "edc_consent.apps.AppConfig",
- "edc_device.apps.AppConfig",
- "edc_facility.apps.AppConfig",
- "edc_lab.apps.AppConfig",
- "edc_list_data.apps.AppConfig",
- "edc_metadata.apps.AppConfig",
- "edc_crf.apps.AppConfig",
- "edc_offstudy.apps.AppConfig",
- "edc_registration.apps.AppConfig",
- "edc_identifier.apps.AppConfig",
- "edc_notification.apps.AppConfig",
- "edc_sites.apps.AppConfig",
- "edc_timepoint.apps.AppConfig",
- "edc_visit_schedule.apps.AppConfig",
- "edc_visit_tracking.apps.AppConfig",
- "edc_dx_review.apps.AppConfig",
- ],
- RANDOMIZATION_LIST_PATH=str(base_dir / app_name / "tests" / "test_randomization_list.csv"),
- 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_dx_review.tests.test_settings", "edc_dx_review.tests")