Skip to content

Commit

Permalink
Merge branch 'release/0.3.86' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Nov 20, 2024
2 parents 8477543 + 61f10fc commit 135b105
Show file tree
Hide file tree
Showing 18 changed files with 165 additions and 143 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[run]
include = edc_adverse_event/*
omit = edc_adverse_event/tests/*,edc_adverse_event/migrations/*
branch = 1
branch = 1
20 changes: 16 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ on: [push, pull_request]

jobs:
build:
name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }})
name: |
build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}, ${{ matrix.database-engine }})
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ['3.12']
django-version: ['4.2', '5.0', '5.1', 'dev']
python-version: ['3.12', '3.13']
django-version: ['5.1', 'dev']
database-engine: ["mysql", "postgres"]

services:
mysql:
Expand All @@ -23,6 +25,17 @@ jobs:
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:latest
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Install pycups and words dependency
Expand Down Expand Up @@ -56,7 +69,6 @@ jobs:
python -m pip install --upgrade pip
python -m pip install -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/tox.txt
- name: Tox tests
run: |
tox -v
Expand Down
17 changes: 10 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ exclude: tests/etc/user-*

repos:
- repo: https://github.com/PyCQA/bandit
rev: 1.7.9
rev: 1.7.10
hooks:
- id: bandit
args:
- "-x *test*.py"

- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
language_version: python3.12
Expand All @@ -28,18 +28,21 @@ repos:
- id: isort

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: requirements-txt-fixer
files: requirements/.*\.txt$
- id: trailing-whitespace
- id: check-added-large-files
- id: fix-byte-order-marker
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: requirements-txt-fixer
files: requirements/.*\.txt$
- id: trailing-whitespace

- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
Expand Down
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Erik van Widenfelt <ew2789@gmail.com>
Erik van Widenfelt <ew2789@gmail.com>
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
{{ action_identifier }}
{% endif %}
{% if status == CANCELLED %}<span style="color: red">{{ status_display }}</span>{% else %}<span>{{ status_display }}</span>{% endif %}

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
{% block branding %}
{% show_navbar_for_admin_templates_b3 %}
{% endblock %}

Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@
{% endif %}
<BR><B>Description:</B>
<BR><div class="ae_description">{{ ae_description|default:ae_initial.ae_description }}</div>

Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,3 @@


{% endblock main %}


Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
local_date,label,country
2017-01-02,Public Holiday,botswana
2017-04-14,Good Friday,botswana
2017-04-15,Public Holiday,botswana
2017-04-17,Easter Monday,botswana
2017-05-01,May Day/Labour Day,botswana
2017-05-25,Ascension Day,botswana
2017-07-01,Sir Seretse Khama Day,botswana
2017-07-17,President's Day,botswana
2017-07-18,Public Holiday,botswana
2017-09-30,Botswana Day,botswana
2017-10-02,Public Holiday,botswana
2017-12-25,Christmas Day,botswana
2017-12-26,Boxing Day,botswana
2017-01-01,New Year,botswana
local_date,label,country
2017-01-02,Public Holiday,botswana
2017-04-14,Good Friday,botswana
2017-04-15,Public Holiday,botswana
2017-04-17,Easter Monday,botswana
2017-05-01,May Day/Labour Day,botswana
2017-05-25,Ascension Day,botswana
2017-07-01,Sir Seretse Khama Day,botswana
2017-07-17,President's Day,botswana
2017-07-18,Public Holiday,botswana
2017-09-30,Botswana Day,botswana
2017-10-02,Public Holiday,botswana
2017-12-25,Christmas Day,botswana
2017-12-26,Boxing Day,botswana
2017-01-01,New Year,botswana
87 changes: 87 additions & 0 deletions edc_adverse_event/tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env python
import sys
from pathlib import Path

from dateutil.relativedelta import relativedelta
from edc_test_settings.default_test_settings import DefaultTestSettings
from edc_utils import get_utcnow

app_name = "edc_adverse_event"
base_dir = Path(__file__).absolute().parent.parent.parent

project_settings = DefaultTestSettings(
calling_file=__file__,
BASE_DIR=base_dir,
APP_NAME=app_name,
ETC_DIR=str(base_dir / app_name / "tests" / "etc"),
HOLIDAY_FILE=base_dir / app_name / "tests" / "etc" / "holidays.csv",
SILENCED_SYSTEM_CHECKS=["sites.E101", "edc_navbar.E002", "edc_navbar.E003"],
SUBJECT_VISIT_MODEL="adverse_event_app.subjectvisit",
ADVERSE_EVENT_APP_LABEL="adverse_event_app",
ADVERSE_EVENT_ADMIN_SITE="adverse_event_app_admin",
EMAIL_ENABLED=True,
EMAIL_CONTACTS={
"ae_reports": "aereports@example.com",
"data_manager": "data_manager@example.com",
"tmg": "tmg@example.com",
},
EDC_PROTOCOL_STUDY_OPEN_DATETIME=get_utcnow().replace(
microsecond=0, second=0, minute=0, hour=0
)
- relativedelta(years=2),
EDC_PROTOCOL_STUDY_CLOSE_DATETIME=get_utcnow().replace(
microsecond=999999, second=59, minute=59, hour=11
)
+ relativedelta(years=2),
EDC_NAVBAR_DEFAULT=app_name,
EDC_AUTH_SKIP_SITE_AUTHS=True,
EDC_AUTH_SKIP_AUTH_UPDATER=True,
EDC_SITES_REGISTER_DEFAULT=True,
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",
"multisite.apps.AppConfig",
"edc_auth.apps.AppConfig",
"edc_action_item.apps.AppConfig",
"edc_adverse_event.apps.AppConfig",
"edc_appointment.apps.AppConfig",
"edc_consent.apps.AppConfig",
"edc_crf.apps.AppConfig",
"edc_data_manager.apps.AppConfig",
"edc_dashboard.apps.AppConfig",
"edc_device.apps.AppConfig",
"edc_facility.apps.AppConfig",
"edc_form_runners.apps.AppConfig",
"edc_identifier.apps.AppConfig",
"edc_lab.apps.AppConfig",
"edc_list_data.apps.AppConfig",
"edc_locator.apps.AppConfig",
"edc_metadata.apps.AppConfig",
"edc_navbar.apps.AppConfig",
"edc_notification.apps.AppConfig",
"edc_offstudy.apps.AppConfig",
"edc_prn.apps.AppConfig",
"edc_protocol.apps.AppConfig",
"edc_randomization.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_tracking.apps.AppConfig",
"edc_visit_schedule.apps.AppConfig",
"adverse_event_app.apps.AppConfig",
"edc_appconfig.apps.AppConfig",
],
add_dashboard_middleware=True,
).settings


for k, v in project_settings.items():
setattr(sys.modules[__name__], k, v)
3 changes: 1 addition & 2 deletions edc_adverse_event/tests/tests/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from model_bakery import baker

from adverse_event_app.visit_schedules import visit_schedule

from ...models import CauseOfDeath
from edc_adverse_event.models import CauseOfDeath


class DeathReportTestMixin:
Expand Down
3 changes: 1 addition & 2 deletions edc_adverse_event/tests/tests/test_ae_and_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
StudyTerminationConclusionAction,
)
from adverse_event_app.models import AeFollowup, AeInitial, AeSusar, AeTmg
from edc_adverse_event.constants import CONTINUING_UPDATE, RECOVERED, RECOVERING
from edc_adverse_event.models import AeClassification

from ...constants import CONTINUING_UPDATE, RECOVERED, RECOVERING


@override_settings(EDC_LIST_DATA_ENABLE_AUTODISCOVER=False)
class TestAeAndActions(TestCase):
Expand Down
7 changes: 3 additions & 4 deletions edc_adverse_event/tests/tests/test_ae_form_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
from edc_sites.tests import SiteTestCaseMixin

from adverse_event_app import list_data
from edc_adverse_event.models import AeClassification, SaeReason

from ...constants import AE_WITHDRAWN
from ...form_validators import (
from edc_adverse_event.constants import AE_WITHDRAWN
from edc_adverse_event.form_validators import (
AeFollowupFormValidator,
AeInitialFormValidator,
AeTmgFormValidator,
)
from edc_adverse_event.models import AeClassification, SaeReason


@override_settings(EDC_LIST_DATA_ENABLE_AUTODISCOVER=False)
Expand Down
5 changes: 4 additions & 1 deletion edc_adverse_event/tests/tests/test_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
from model_bakery import baker

from adverse_event_app import list_data
from edc_adverse_event.notifications import (
AeInitialG3EventNotification,
AeInitialG4EventNotification,
)

from ...action_items import (
AeFollowupAction,
Expand All @@ -16,7 +20,6 @@
DeathReportAction,
DeathReportTmgAction,
)
from ...notifications import AeInitialG3EventNotification, AeInitialG4EventNotification
from .mixins import DeathReportTestMixin


Expand Down
2 changes: 1 addition & 1 deletion edc_adverse_event/view_utils/tmg_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

from django.utils.translation import gettext as _
from edc_subject_dashboard.view_utils import ModelButton
from edc_view_utils import ModelButton

if TYPE_CHECKING:
from edc_action_item.models import ActionItem
Expand Down
33 changes: 22 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[build-system]
requires = ["setuptools>=60", "setuptools-scm>=8.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
version_file="_version.py"
version_file = "_version.py"

[tool.black]
line-length = 95
Expand Down Expand Up @@ -35,35 +36,33 @@ exclude_lines = [
legacy_tox_ini = """
[tox]
envlist =
py{312}-dj{42,50,51,dev},
py{312,313}-dj{51,dev},
lint
pre-commit
isolated_build = true
[gh-actions]
python =
3.12: py312, lint
3.12: py312, lint, pre-commit
3.13: py313
[gh-actions:env]
DJANGO =
4.2: dj42
5.0: dj50
5.1: dj51
dev: djdev, lint
dev: djdev, lint, pre-commit
[testenv]
deps =
-r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/tox.txt
-r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/test_utils.txt
-r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/edc.txt
-r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/third_party_dev.txt
dj42: Django>=4.2,<5.0
dj50: Django>=5.0,<5.1
dj51: Django>=5.1
dj51: Django>=5.1,<5.2
djdev: https://github.com/django/django/tarball/main
commands =
pip install -U pip coverage[toml]
pip install -U pip
python --version
pip --version
pip freeze
coverage run -a runtests.py
Expand All @@ -72,7 +71,19 @@ commands =
[testenv:lint]
deps = -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/lint.txt
commands =
python --version
pip --version
pip freeze
isort --profile=black --check --diff .
black --check --diff .
flake8 .
[testenv:pre-commit]
deps = pre-commit
commands =
python --version
pip --version
pip freeze
pre-commit autoupdate
pre-commit run --all-files
"""
Loading

0 comments on commit 135b105

Please sign in to comment.