def __call__(self):
raise AssertionError(self.message)
}}}
([https://github.com/django/django/blob/dfa1145a22042dcf9e504a5a7edd5557e3e0d07c/django/test/testcases.py#L142-L148
source])
Using a custom/distinctive exception type would allow for better catching
and handling of this.
Currently you would have to parse its {{{message}}} and/or look at the
stack trace to see if it's this specific error, or a "normal" assertion
error from a test.
--
Ticket URL: <https://code.djangoproject.com/ticket/33278>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Simon Charette (added)
* stage: Unreviewed => Accepted
Comment:
Sounds reasonable, thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/33278#comment:1>
Comment (by Simon Charette):
Sounds reasonable to me as well, I assume we'll want to subclass
`AssertionError` but a distinct type shouldn't hurt.
--
Ticket URL: <https://code.djangoproject.com/ticket/33278#comment:2>
* owner: nobody => SwastikTripathi
* status: new => assigned
Comment:
Yes we can surely do that. Here's my PR
[https://github.com/django/django/pull/15082]
--
Ticket URL: <https://code.djangoproject.com/ticket/33278#comment:3>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33278#comment:4>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33278#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"76f07b4fcfa570d194ee4ee8e20d56fd917998a7" 76f07b4f]:
{{{
#!CommitTicketReference repository=""
revision="76f07b4fcfa570d194ee4ee8e20d56fd917998a7"
Fixed #33278 -- Improved error for connection/query attempts against
disallowed databases in tests.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33278#comment:6>