From b7edf4965968d9738e76a6578fb02dcc91bb45f2 Mon Sep 17 00:00:00 2001 From: Charlie Brodie Date: Mon, 28 Jun 2021 12:24:32 +0100 Subject: [PATCH 1/2] Changed 'url' instances in docs and tests to 'path'. 'path' was introduced in django 2.0 (the minimum supported version for django-health-check) as a simpler replacement for url and url was officially deprecated in Django 3.1. --- README.rst | 4 ++-- docs/settings.rst | 2 +- tests/testapp/urls.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 0625ecda..59852645 100644 --- a/README.rst +++ b/README.rst @@ -56,7 +56,7 @@ Add the health checker to a URL you want to use: urlpatterns = [ # ... - url(r'^ht/', include('health_check.urls')), + path('ht/', include('health_check.urls')), ] Add the ``health_check`` applications to your ``INSTALLED_APPS``: @@ -268,7 +268,7 @@ and customizing the ``template_name``, ``get``, ``render_to_response`` and ``ren urlpatterns = [ # ... - url(r'^ht/$', views.HealthCheckCustomView.as_view(), name='health_check_custom'), + path('ht/', views.HealthCheckCustomView.as_view(), name='health_check_custom'), ] Django command diff --git a/docs/settings.rst b/docs/settings.rst index 96be9a44..c96233bf 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -33,7 +33,7 @@ Add it to your URL: urlpatterns = [ # ... - url(r'^ht/super_secret_token/'), include('health_check.urls')), + path('ht/super_secret_token/'), include('health_check.urls')), ] You can still use any uptime bot that is URL based while enjoying token protection. diff --git a/tests/testapp/urls.py b/tests/testapp/urls.py index 29f1acc9..70244e44 100644 --- a/tests/testapp/urls.py +++ b/tests/testapp/urls.py @@ -1,5 +1,5 @@ -from django.conf.urls import include, url +from django.urls import include, path urlpatterns = [ - url(r'^ht/', include('health_check.urls')), + path('ht/', include('health_check.urls')), ] From 1d85557511129fa5a4736cabbffde531355caf65 Mon Sep 17 00:00:00 2001 From: Charlie Brodie Date: Mon, 28 Jun 2021 12:40:18 +0100 Subject: [PATCH 2/2] Replaced deprecated 'yield_fixture' with 'fixture'. This removes any warnings when running the tests. --- tests/test_commands.py | 2 +- tests/test_mixins.py | 2 +- tests/test_plugins.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_commands.py b/tests/test_commands.py index e0149058..c7b69970 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -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) diff --git a/tests/test_mixins.py b/tests/test_mixins.py index 4d5f50f4..c853e47c 100644 --- a/tests/test_mixins.py +++ b/tests/test_mixins.py @@ -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) diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 6329c7ad..879d4b9d 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -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)