diff --git a/tests/panels/test_staticfiles.py b/tests/panels/test_staticfiles.py index 7aa85d889..d660b3c77 100644 --- a/tests/panels/test_staticfiles.py +++ b/tests/panels/test_staticfiles.py @@ -1,13 +1,11 @@ import os +import unittest +import django from django.conf import settings from django.contrib.staticfiles import finders -from django.core.checks import Warning -from django.test import SimpleTestCase from django.test.utils import override_settings -from debug_toolbar.panels.staticfiles import StaticFilesPanel - from ..base import BaseTestCase PATH_DOES_NOT_EXIST = os.path.join(settings.BASE_DIR, "tests", "invalid_static") @@ -54,6 +52,7 @@ def test_insert_content(self): ) self.assertValidHTML(content) + @unittest.skipIf(django.VERSION >= (4,), "Django>=4 handles missing dirs itself.") @override_settings( STATICFILES_DIRS=[PATH_DOES_NOT_EXIST] + settings.STATICFILES_DIRS, STATIC_ROOT=PATH_DOES_NOT_EXIST, @@ -81,20 +80,3 @@ def test_finder_directory_does_not_exist(self): self.assertEqual( self.panel.get_staticfiles_dirs(), finders.FileSystemFinder().locations ) - - -@override_settings(DEBUG=True) -class StaticFilesPanelChecksTestCase(SimpleTestCase): - @override_settings(STATICFILES_DIRS=[PATH_DOES_NOT_EXIST]) - def test_run_checks(self): - messages = StaticFilesPanel.run_checks() - self.assertEqual( - messages, - [ - Warning( - "debug_toolbar requires the STATICFILES_DIRS directories to exist.", - hint="Running manage.py collectstatic may help uncover the issue.", - id="debug_toolbar.staticfiles.W001", - ) - ], - ) diff --git a/tests/test_checks.py b/tests/test_checks.py index 935750d3f..a1c59614a 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -1,5 +1,7 @@ import os +import unittest +import django from django.conf import settings from django.core.checks import Warning, run_checks from django.test import SimpleTestCase, override_settings @@ -89,6 +91,7 @@ def test_check_middleware_classes_error(self): messages, ) + @unittest.skipIf(django.VERSION >= (4,), "Django>=4 handles missing dirs itself.") @override_settings( STATICFILES_DIRS=[PATH_DOES_NOT_EXIST], )