diff --git a/debug_toolbar/apps.py b/debug_toolbar/apps.py index ffae34209..614ce98f7 100644 --- a/debug_toolbar/apps.py +++ b/debug_toolbar/apps.py @@ -177,7 +177,7 @@ def check_panels(app_configs, **kwargs): return errors -@register() +@register def js_mimetype_check(app_configs, **kwargs): """ Check that JavaScript files are resolving to the correct content type. @@ -208,7 +208,7 @@ def js_mimetype_check(app_configs, **kwargs): return [] -@register() +@register def debug_toolbar_installed_when_running_tests_check(app_configs, **kwargs): """ Check that the toolbar is not being used when tests are running @@ -223,13 +223,14 @@ def debug_toolbar_installed_when_running_tests_check(app_configs, **kwargs): "the toolbar when running tests. If you feel this check is in error, " "you can set `DEBUG_TOOLBAR_CONFIG['IS_RUNNING_TESTS'] = False` to " "bypass this check.", - id="debug_toolbar.W008", + id="debug_toolbar.W009", ) ] else: return [] +@register def check_settings(app_configs, **kwargs): errors = [] USER_CONFIG = getattr(settings, "DEBUG_TOOLBAR_CONFIG", {}) diff --git a/docs/changes.rst b/docs/changes.rst index 959d42dde..7a737231f 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -22,6 +22,8 @@ Pending ``DEBUG_TOOLBAR_SETTINGS``. * Add a note on the profiling panel about using Python 3.12 and later about needing ``--nothreading`` +* Fixed the bug causing ``'djdt' is not a registered namespace`` and updated + docs to help in initial configuration while running tests. 4.3.0 (2024-02-01) ------------------ diff --git a/tests/test_checks.py b/tests/test_checks.py index 6362d47b0..1718fa4c6 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -101,16 +101,6 @@ def test_panels_is_empty(self): "settings.py.", id="debug_toolbar.W005", ), - Error( - "The Django Debug Toolbar can't be used with tests", - hint="Django changes the DEBUG setting to False when running " - "tests. By default the Django Debug Toolbar is installed because " - "DEBUG is set to True. For most cases, you need to avoid installing " - "the toolbar when running tests. If you feel this check is in error, " - "you can set `DEBUG_TOOLBAR_CONFIG['IS_RUNNING_TESTS'] = False` to " - "bypass this check.", - id="debug_toolbar.W008", - ), ], ) @@ -276,13 +266,16 @@ def test_debug_toolbar_installed_when_running_tests(self): "the toolbar when running tests. If you feel this check is in error, " "you can set `DEBUG_TOOLBAR_CONFIG['IS_RUNNING_TESTS'] = False` to " "bypass this check.", - id="debug_toolbar.W008", + id="debug_toolbar.W009", ) ], ) @override_settings( - DEBUG_TOOLBAR_CONFIG={"OBSERVE_REQUEST_CALLBACK": lambda request: False} + DEBUG_TOOLBAR_CONFIG={ + "OBSERVE_REQUEST_CALLBACK": lambda request: False, + "IS_RUNNING_TESTS": False, + } ) def test_observe_request_callback_specified(self): errors = run_checks()