Skip to content

Commit

Permalink
Resolve deprecation warnings in test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
codingjoe committed Sep 2, 2022
1 parent 60354a7 commit 61625cf
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 20 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -71,6 +71,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install Django~="${{ matrix.django-version }}.0"
- run: python setup.py test
- run: python -m pip install .[test]
- run: python -m pip install Django~="${{ matrix.django-version }}.0"
- run: python -m pytest
- uses: codecov/codecov-action@v3
9 changes: 3 additions & 6 deletions setup.cfg
Expand Up @@ -42,10 +42,9 @@ install_requires =
django>=2.2
setup_requires =
setuptools_scm
sphinx
pytest-runner
tests_require =
mock

[options.extras_require]
test =
pytest
pytest-cov
pytest-django
Expand All @@ -70,8 +69,6 @@ addopts =
--tb=short
-rxs
--cov=health_check
--cov-report=term
--cov-report=xml

[flake8]
max-line-length = 88
Expand Down
3 changes: 2 additions & 1 deletion tests/test_cache.py
@@ -1,6 +1,7 @@
from unittest.mock import patch

from django.core.cache.backends.base import BaseCache, CacheKeyWarning
from django.test import TestCase
from mock import patch

from health_check.cache.backends import CacheBackend

Expand Down
5 changes: 3 additions & 2 deletions tests/test_celery_ping.py
@@ -1,7 +1,8 @@
from unittest.mock import patch

import pytest
from django.apps import apps
from django.conf import settings
from mock import patch

from health_check.contrib.celery_ping.apps import HealthCheckConfig
from health_check.contrib.celery_ping.backends import CeleryPingHealthCheck
Expand All @@ -19,7 +20,7 @@ class TestCeleryPingHealthCheck:
def health_check(self):
return CeleryPingHealthCheck()

def test_check_status_doesnt_add_errors_when_ping_successfull(self, health_check):
def test_check_status_doesnt_add_errors_when_ping_successful(self, health_check):
celery_worker = "celery@4cc150a7b49b"

with patch(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_commands.py
Expand Up @@ -18,7 +18,7 @@ def check_status(self):


class TestCommand:
@pytest.yield_fixture(autouse=True)
@pytest.fixture(autouse=True)
def setup(self):
plugin_dir.reset()
plugin_dir.register(FailPlugin)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_db.py
@@ -1,7 +1,8 @@
from unittest.mock import patch

from django.db import DatabaseError, IntegrityError
from django.db.models import Model
from django.test import TestCase
from mock import patch

from health_check.db.backends import DatabaseBackend

Expand Down
3 changes: 2 additions & 1 deletion tests/test_migrations.py
@@ -1,6 +1,7 @@
from unittest.mock import patch

from django.db.migrations import Migration
from django.test import TestCase
from mock import patch

from health_check.contrib.migrations.backends import MigrationsHealthCheck

Expand Down
2 changes: 1 addition & 1 deletion tests/test_mixins.py
Expand Up @@ -20,7 +20,7 @@ class Checker(CheckMixin):


class TestCheckMixin:
@pytest.yield_fixture(autouse=True)
@pytest.fixture(autouse=True)
def setup(self):
plugin_dir.reset()
plugin_dir.register(FailPlugin)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugins.py
Expand Up @@ -15,7 +15,7 @@ def check_status(self):


class TestPlugin:
@pytest.yield_fixture(autouse=True)
@pytest.fixture(autouse=True)
def setup(self):
plugin_dir.reset()
plugin_dir.register(FakePlugin)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_rabbitmq.py
@@ -1,4 +1,5 @@
import mock
from unittest import mock

from amqp.exceptions import AccessRefused

from health_check.contrib.rabbitmq.backends import RabbitMQHealthCheck
Expand Down
3 changes: 2 additions & 1 deletion tests/test_redis.py
@@ -1,4 +1,5 @@
import mock
from unittest import mock

from redis.exceptions import ConnectionError, TimeoutError

from health_check.contrib.redis.backends import RedisHealthCheck
Expand Down
3 changes: 2 additions & 1 deletion tests/test_storage.py
@@ -1,4 +1,5 @@
import mock
from unittest import mock

from django.core.files.storage import Storage
from django.test import TestCase

Expand Down
2 changes: 1 addition & 1 deletion tests/testapp/settings.py
Expand Up @@ -58,7 +58,7 @@

SECRET_KEY = uuid.uuid4().hex

USE_L10N = True
USE_TZ = True

CELERY_QUEUES = [
Queue("default"),
Expand Down

0 comments on commit 61625cf

Please sign in to comment.