Test for SuspiciousOperation subclasses rather than SuspiciousOperation in Django's tests
tests/requests/tests.py
contains some less specific tests. Actually, it's DisallowedHost
that's being raised instead for all of these cases. Isn't it better in general to test for the actual exception class? Probably there are other cases of tests like this that could be made more specific.
with self.assertRaises(SuspiciousOperation):
Change History
(5)
Summary: |
Test suite exception catching is not always specific → Use more specific exception testing in Django's tests
|
Triage Stage: |
Unreviewed → Accepted
|
Owner: |
changed from nobody to Rajesh Veeranki
|
Status: |
new → assigned
|
Summary: |
Use more specific exception testing in Django's tests → Test for SuspiciousOperation subclasses rather than SuspiciousOperation in Django's tests
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Please review the PR here: https://github.com/django/django/pull/8545
I have searched the tests for any instances of
SuspiciousOperation
and replaced with appropriate derived exception