From fc6813e3240b4a8244b6568d30f6dc9e059b9b9a Mon Sep 17 00:00:00 2001 From: erikvw Date: Wed, 13 Dec 2023 00:08:23 -0600 Subject: [PATCH 1/2] set site id in tests --- runtests.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/runtests.py b/runtests.py index 55a5786..da11621 100644 --- a/runtests.py +++ b/runtests.py @@ -1,23 +1,19 @@ #!/usr/bin/env python import logging -import os -import sys -from os.path import abspath, dirname +from pathlib import Path -import django -from django.conf import settings -from django.test.runner import DiscoverRunner -from edc_test_utils import DefaultTestSettings +from edc_test_utils import DefaultTestSettings, func_main app_name = "edc_timepoint" -base_dir = dirname(abspath(__file__)) +base_dir = Path(__file__).absolute().parent -DEFAULT_SETTINGS = DefaultTestSettings( +project_settings = DefaultTestSettings( calling_file=__file__, BASE_DIR=base_dir, APP_NAME=app_name, - ETC_DIR=os.path.join(base_dir, app_name, "tests", "etc"), + ETC_DIR=str(base_dir / app_name / "tests" / "etc"), SUBJECT_VISIT_MODEL="edc_timepoint.subjectvisit", + EDC_SITES_REGISTER_DEFAULT=True, INSTALLED_APPS=[ "django.contrib.admin", "django.contrib.auth", @@ -52,12 +48,7 @@ def main(): - if not settings.configured: - settings.configure(**DEFAULT_SETTINGS) - django.setup() - tags = [t.split("=")[1] for t in sys.argv if t.startswith("--tag")] - failures = DiscoverRunner(failfast=False, tags=tags).run_tests([f"{app_name}.tests"]) - sys.exit(failures) + func_main(project_settings, *[f"{app_name}.tests"]) if __name__ == "__main__": From cd176514c1da3a60b71f98e604272d07fdad5c84 Mon Sep 17 00:00:00 2001 From: erikvw Date: Thu, 14 Dec 2023 15:32:01 -0600 Subject: [PATCH 2/2] test setup --- .github/workflows/build.yml | 10 ++++++++-- README.rst | 4 ++-- pyproject.toml | 12 ++++++++---- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 39f9299..4ec2681 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,8 +11,14 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.11'] - django-version: ['4.2', 'dev'] + python-version: ['3.11', '3.12'] + django-version: ['4.2', '5.0', 'dev'] + + exclude: + - python-version: '3.12' + django-version: '4.2' + - python-version: '3.11' + django-version: 'dev' services: mysql: image: mysql:latest diff --git a/README.rst b/README.rst index 03e4838..9bc8302 100644 --- a/README.rst +++ b/README.rst @@ -98,8 +98,8 @@ If the timepoint model's ``timepoint_status`` is ``closed``, any attempt to crea .. |pypi| image:: https://img.shields.io/pypi/v/edc-timepoint.svg :target: https://pypi.python.org/pypi/edc-timepoint -.. |actions| image:: https://github.com/clinicedc/edc-timepoint/workflows/build/badge.svg?branch=develop - :target: https://github.com/clinicedc/edc-timepoint/actions?query=workflow:build +.. |actions| image:: https://github.com/clinicedc/edc-timepoint/actions/workflows/build.yml/badge.svg + :target: https://github.com/clinicedc/edc-timepoint/actions/workflows/build.yml .. |codecov| image:: https://codecov.io/gh/clinicedc/edc-timepoint/branch/develop/graph/badge.svg :target: https://codecov.io/gh/clinicedc/edc-timepoint diff --git a/pyproject.toml b/pyproject.toml index 21ac210..96a5d64 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,19 +35,22 @@ exclude_lines = [ legacy_tox_ini = """ [tox] envlist = - py{311}-dj{42,dev}, + py{311}-dj{42,50}, + py{312}-dj{50,dev}, lint isolated_build = true [gh-actions] python = - 3.11: py311, lint + 3.11: py311 + 3.12: py312, lint [gh-actions:env] DJANGO = - 4.2: dj42, lint - dev: djdev + 4.2: dj42 + 5.0: dj50 + dev: djdev, lint [testenv] deps = @@ -56,6 +59,7 @@ deps = -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 djdev: https://github.com/django/django/tarball/main commands =