Skip to content

HttpForbidden and Http404 are logged in test runner #1709

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

Closed
Shriukan33 opened this issue Nov 17, 2022 · 3 comments
Closed

HttpForbidden and Http404 are logged in test runner #1709

Shriukan33 opened this issue Nov 17, 2022 · 3 comments

Comments

@Shriukan33
Copy link

Hello,

I've updated my django-debug-toolbar from 3.2.4 to 3.7 and I noticed that the traceback was printed when the tests encountered 404 or 403 responses.

I was wondering if I could disable that ? Back in 3.2.4 the test results wouldn't be polluted with errors tracebacks.

Example :

Traceback (most recent call last):
  File "/home/benja/Documents/GitHub/tn_web/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/home/benja/Documents/GitHub/tn_web/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/benja/Documents/GitHub/tn_web/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 103, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/benja/Documents/GitHub/tn_web/venv/lib/python3.8/site-packages/django/contrib/auth/mixins.py", line 108, in dispatch
    return self.handle_no_permission()
  File "/home/benja/Documents/GitHub/tn_web/venv/lib/python3.8/site-packages/django/contrib/auth/mixins.py", line 48, in handle_no_permission
    raise PermissionDenied(self.get_permission_denied_message())
django.core.exceptions.PermissionDenied
Not Found: /tb/admin/panel/view/999999999/
Not Found: /tb/admin/panel/view/1/
.Not Found: /tb/panel/bad-slug/

Except those tests do expect to produce 403/404 responses.

I don't see the link with django-debug-toolbar but the behavior doesn't happen when I rollback to 3.2.4 so I guess there is something ?

Thank you !

@matthiask
Copy link
Member

That's probably a duplicate of #1681

Logging is a bit too loud now. It was too silent in the past. The best solution hasn't been found yet.

@tim-schilling
Copy link
Member

Another option would be to configure your project to not load the toolbar when running tests.

@Shriukan33
Copy link
Author

Shriukan33 commented Nov 17, 2022

Indeed, I missed that topic !
It seems to be the same problem.

This issue may be closed to keep the discussion there :)

Another option would be to configure your project to not load the toolbar when running tests.

@tim-schilling
I tried to remove "debug_toolbar" from installed apps and the debug_toolbar.middleware.DebugToolbarMiddleware from MIDDLEWARE, I still get the logs :/

@tim-schilling tim-schilling closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants