You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BaseTestCase.request allows e.g. self.get() with a named url, or a plain url as a fallback where the method is called within exception handling for reverse().
In the latter case, if the method fails, the exception chain will include less relevant traces:
Traceback (most recent call last):
File "[...]/site-packages/django/urls/base.py", line 75, in reverse
extra, resolver = resolver.namespace_dict[ns]
KeyError: 'https'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "[...]/site-packages/test_plus/test.py", line 133, in request
self.last_response = method(reverse(url_name, args=args, kwargs=kwargs), data=data, follow=follow, **extra)
File "[...]/site-packages/django/urls/base.py", line 86, in reverse
raise NoReverseMatch("%s is not a registered namespace" % key)
django.urls.exceptions.NoReverseMatch: 'https' is not a registered namespace
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
[the actual test exception goes here]
Probably it would be preferable to call the method outside exception handling for reverse(), i.e.
try:
url = reverse(url_name, args=args, kwargs=kwargs)
except NoReverseMatch:
if args or kwargs:
raise # unpopped (kw)args implies named url
url = url_name
self.last_response = method(url, data=data, follow=follow, **extra)
😃 No reverse()-related traces in failing tests when plain url used
😢 NoReverseMatch lost if invalid named url used without (kw)args, will barf only in fallback instead
🤔 Plain url with discarded (kw)args will barf non-backwards-compleniently
The text was updated successfully, but these errors were encountered:
BaseTestCase.request allows e.g. self.get() with a named url, or a plain url as a fallback where the method is called within exception handling for reverse().
In the latter case, if the method fails, the exception chain will include less relevant traces:
Probably it would be preferable to call the method outside exception handling for reverse(), i.e.
😃 No reverse()-related traces in failing tests when plain url used
😢 NoReverseMatch lost if invalid named url used without (kw)args, will barf only in fallback instead
🤔 Plain url with discarded (kw)args will barf non-backwards-compleniently
The text was updated successfully, but these errors were encountered: