Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve deprecation warnings in test suite #331

Merged
merged 1 commit into from Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -49,8 +49,8 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: check docs
run: python setup.py build_sphinx
- run: python -m pip install -e .[docs]
- run: python -m sphinx -b html -W docs docs/_build

PyTest:
runs-on: ubuntu-latest
Expand All @@ -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
16 changes: 5 additions & 11 deletions setup.cfg
Expand Up @@ -42,15 +42,16 @@ install_requires =
django>=2.2
setup_requires =
setuptools_scm
sphinx
pytest-runner
tests_require =
mock

[options.extras_require]
test =
pytest
pytest-cov
pytest-django
celery
redis
docs =
sphinx

[bdist_wheel]
universal = 1
Expand All @@ -70,8 +71,6 @@ addopts =
--tb=short
-rxs
--cov=health_check
--cov-report=term
--cov-report=xml

[flake8]
max-line-length = 88
Expand Down Expand Up @@ -106,8 +105,3 @@ ignore_errors = True
show_missing = True
skip_covered = True
sort = Cover

[build_sphinx]
source_dir = docs
build_dir = docs/_build
warning-is-error = 1
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