From bc075bc95e45bad9a3e15baa1bb7b94fd0c3e744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Sun, 10 May 2026 19:52:02 +0200 Subject: [PATCH] Remove silk --- config/settings.py | 3 +-- config/tests/test_settings.py | 4 +--- config/tests/test_urls.py | 8 +++----- config/urls.py | 1 - pyproject.toml | 1 - twitch/tests/test_backup.py | 6 ++---- 6 files changed, 7 insertions(+), 16 deletions(-) diff --git a/config/settings.py b/config/settings.py index 85a4757..b4f40ee 100644 --- a/config/settings.py +++ b/config/settings.py @@ -229,10 +229,9 @@ if DEBUG or TESTING: MIDDLEWARE.append("zeal.middleware.zeal_middleware") if not TESTING: - INSTALLED_APPS = [*INSTALLED_APPS, "debug_toolbar", "silk"] + INSTALLED_APPS.append("debug_toolbar") MIDDLEWARE = [ "debug_toolbar.middleware.DebugToolbarMiddleware", - "silk.middleware.SilkyMiddleware", *MIDDLEWARE, ] diff --git a/config/tests/test_settings.py b/config/tests/test_settings.py index aa84ab9..5c017c9 100644 --- a/config/tests/test_settings.py +++ b/config/tests/test_settings.py @@ -316,18 +316,16 @@ def test_debug_tools_installed_only_when_not_testing( monkeypatch: pytest.MonkeyPatch, reload_settings_module: Callable[..., ModuleType], ) -> None: - """`debug_toolbar` and `silk` are only added when not TESTING.""" + """`debug_toolbar` is only added when not TESTING.""" # Not testing -> tools should be present monkeypatch.setattr("sys.argv", ["manage.py", "runserver"]) monkeypatch.delenv("PYTEST_VERSION", raising=False) not_testing: ModuleType = reload_settings_module(TESTING=None, PYTEST_VERSION=None) assert "debug_toolbar" in not_testing.INSTALLED_APPS - assert "silk" in not_testing.INSTALLED_APPS # Testing -> tools should not be present testing: ModuleType = reload_settings_module(PYTEST_VERSION="7.0.0") assert "debug_toolbar" not in testing.INSTALLED_APPS - assert "silk" not in testing.INSTALLED_APPS def test_logging_configuration_structure() -> None: diff --git a/config/tests/test_urls.py b/config/tests/test_urls.py index e51c595..e5a555b 100644 --- a/config/tests/test_urls.py +++ b/config/tests/test_urls.py @@ -49,11 +49,10 @@ def test_top_level_named_routes_available() -> None: def test_debug_tools_not_present_while_testing() -> None: - """`silk` and Django Debug Toolbar URL patterns are not present while running tests.""" + """Django Debug Toolbar URL patterns are not present while running tests.""" # Default test environment should *not* expose debug routes. mod = _reload_urls_with(TESTING=True) patterns = list(_pattern_strings(mod)) - assert not any("silk" in p for p in patterns) assert not any("__debug__" in p or "debug" in p for p in patterns) @@ -90,8 +89,7 @@ def test_media_serving_in_development() -> None: assert any("MEDIA_URL" in str(pattern) for pattern in urlpatterns) -def test_debug_toolbar_and_silk_urls() -> None: - """Test that debug toolbar and Silk URLs are included when appropriate.""" +def test_debug_toolbar_urls() -> None: + """Test that debug toolbar URLs are included when appropriate.""" if not settings.TESTING: - assert any("silk.urls" in str(pattern) for pattern in urlpatterns) assert any("debug_toolbar" in str(pattern) for pattern in urlpatterns) diff --git a/config/urls.py b/config/urls.py index 6abb8f8..f4d56ad 100644 --- a/config/urls.py +++ b/config/urls.py @@ -62,5 +62,4 @@ if settings.DEBUG: if not settings.TESTING: from debug_toolbar.toolbar import debug_toolbar_urls - urlpatterns += [path("silk/", include("silk.urls", namespace="silk"))] urlpatterns = [*urlpatterns, *debug_toolbar_urls()] diff --git a/pyproject.toml b/pyproject.toml index ea57c1d..dcaf47e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,6 @@ dependencies = [ "django-celery-results", "django-debug-toolbar", "django-ninja", - "django-silk", "django-zeal", "django", "flower", diff --git a/twitch/tests/test_backup.py b/twitch/tests/test_backup.py index 1123a7a..3a2c50f 100644 --- a/twitch/tests/test_backup.py +++ b/twitch/tests/test_backup.py @@ -109,11 +109,10 @@ class TestBackupCommand: ): content: str = handle.read() - # Should NOT contain django admin, silk, or debug toolbar tables + # Should NOT contain django admin or debug toolbar tables assert "django_session" not in content assert "django_migrations" not in content assert "django_content_type" not in content - assert "silk_" not in content assert "debug_toolbar_" not in content assert "django_admin_log" not in content assert "auth_" not in content @@ -215,9 +214,8 @@ class TestBackupHelperFunctions: # Use Django's connection to access the test database tables = _get_allowed_tables("twitch_") - # Should not include django, silk, or debug toolbar tables + # Should not include django or debug toolbar tables assert not any(table.startswith("django_") for table in tables) - assert not any(table.startswith("silk_") for table in tables) assert not any(table.startswith("debug_toolbar_") for table in tables) def test_sql_literal_handles_none(self) -> None: