Skip to content

Commit

Permalink
compatibility fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Nistler committed Mar 6, 2024
1 parent d076469 commit 43ba5ab
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 24 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ WORKDIR /app
USER app

ADD requirements-test.txt /app/
ADD requirements-ci.txt /app/

ENV PATH /home/app/venv/bin:${PATH}

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[![PyPI version](https://badge.fury.io/py/django-datawatch.svg)](https://badge.fury.io/py/django-datawatch)
[![GitHub build status](https://github.com/RegioHelden/django-datawatch/workflows/Test/badge.svg)](https://github.com/RegioHelden/django-datawatch/actions)
[![Coverage Status](https://coveralls.io/repos/github/RegioHelden/django-datawatch/badge.svg?branch=add_coveralls)](https://coveralls.io/github/RegioHelden/django-datawatch?branch=add_coveralls)
[![Open Source Love](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)
[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)

Expand Down
38 changes: 31 additions & 7 deletions django_datawatch/tests/test_scheduler.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import datetime
import pytz
from unittest import mock

from celery.schedules import crontab
from django.test.testcases import TestCase
from django.conf import settings
from django.utils import timezone
from time_machine import travel

from django_datawatch.base import BaseCheck
Expand Down Expand Up @@ -47,8 +47,16 @@ def test_execution_in_past(self, mock_run):

scheduler.get_last_executions = mock.MagicMock(return_value={
'django_datawatch.tests.test_scheduler.CheckRunEvery':
datetime.datetime(2016, 1, 1, 0, 0, 0, 0, pytz.timezone(
settings.TIME_ZONE)),
datetime.datetime(
2016,
1,
1,
0,
0,
0,
0,
tzinfo=timezone.get_current_timezone(),
),
})
scheduler.run_checks()
self.assertTrue(mock_run.called)
Expand All @@ -62,8 +70,16 @@ def test_execution_in_future(self, mock_run):

scheduler.get_last_executions = mock.MagicMock(return_value={
'django_datawatch.tests.test_scheduler.CheckRunEvery':
datetime.datetime(2016, 12, 1, 0, 0, 0, 0, pytz.timezone(
settings.TIME_ZONE)),
datetime.datetime(
2016,
12,
1,
0,
0,
0,
0,
tzinfo=timezone.get_current_timezone(),
),
})
scheduler.run_checks()
self.assertFalse(mock_run.called)
Expand All @@ -77,8 +93,16 @@ def test_execution_in_future_and_force(self, mock_run):

scheduler.get_last_executions = mock.MagicMock(return_value={
'django_datawatch.tests.test_scheduler.CheckRunEvery':
datetime.datetime(2016, 12, 1, 0, 0, 0, 0, pytz.timezone(
settings.TIME_ZONE)),
datetime.datetime(
2016,
12,
1,
0,
0,
0,
0,
tzinfo=timezone.get_current_timezone(),
),
})
scheduler.run_checks(force=True)
self.assertTrue(mock_run.called)
2 changes: 1 addition & 1 deletion django_datawatch/tests/test_trigger_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_update_related_calls_backend(self, mock_get_backend):
with self.captureOnCommitCallbacks() as callbacks:
datawatch.update_related(sender=Result, instance=Result(pk=143243, slug="143243"))

self.assertEquals(3, len(callbacks))
self.assertEqual(3, len(callbacks))

parameters = [
dict(slug='django_datawatch.tests.test_trigger_update.CheckTriggerUpdate', identifier=143243, run_async=True),
Expand Down
8 changes: 8 additions & 0 deletions requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
celery==5.3.6
django-bootstrap5==23.4
django-extensions==3.2.3
django-model-utils==4.4.0
django-celery-beat==2.6.0
python-dateutil==2.9.0.post0
tblib==3.0.0
time-machine==2.14.0
10 changes: 1 addition & 9 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
-r requirements-ci.txt
bumpversion==0.6.0
celery==5.3.6
coveralls==3.3.1
django-bootstrap5==23.4
django-extensions==3.2.3
django-model-utils==4.4.0
django-celery-beat==2.6.0
pip-check==2.8.1
psycopg==3.1.18
python-dateutil==2.9.0.post0
tblib==3.0.0
time-machine==2.14.0
22 changes: 16 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@ jobs = auto
setenv =
PYTHONPATH = {toxinidir}
deps =
django32: Django>=3.2,<4.0
django40: Django>=4.0,<4.1
django41: Django>=4.1,<4.2
django42: Django>=4.2,<4.3
djangp50: Django>=5.0,<5.1
-r{toxinidir}/requirements-test.txt
django32:
Django>=3.2,<4.0
psycopg2==2.9.9
django40:
Django>=4.0,<4.1
psycopg2==2.9.9
django41:
Django>=4.1,<4.2
psycopg2==2.9.9
django42:
Django>=4.2,<4.3
psycopg==3.1.18
djangp50:
Django>=5.0,<5.1
psycopg==3.1.18
-r{toxinidir}/requirements-ci.txt
commands =
pip install -U pip
python manage.py test

0 comments on commit 43ba5ab

Please sign in to comment.