[Django] #28224: Test suite exception catching is not always specific

已查看 5 次
跳至第一个未读帖子

Django

未读,
2017年5月19日 11:35:482017/5/19
收件人 django-...@googlegroups.com
#28224: Test suite exception catching is not always specific
-------------------------------------+-------------------------------------
Reporter: Mads | Owner: nobody
Jensen |
Type: | Status: new
Cleanup/optimization |
Component: Core | Version: master
(Other) |
Severity: Normal | Keywords: exception classes
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
`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):
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28224>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

未读,
2017年5月19日 13:14:412017/5/19
收件人 django-...@googlegroups.com
#28224: Use more specific exception testing in Django's tests
--------------------------------------+------------------------------------
Reporter: Mads Jensen | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: exception classes | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/28224#comment:1>

Django

未读,
2017年5月24日 15:20:442017/5/24
收件人 django-...@googlegroups.com
#28224: Use more specific exception testing in Django's tests
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Rajesh
Type: | Veeranki
Cleanup/optimization | Status: assigned

Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: exception classes | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Rajesh Veeranki):

* owner: nobody => Rajesh Veeranki
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/28224#comment:2>

Django

未读,
2017年5月24日 15:45:282017/5/24
收件人 django-...@googlegroups.com
#28224: Use more specific exception testing in Django's tests
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Rajesh
Type: | Veeranki
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: exception classes | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Rajesh Veeranki):

* has_patch: 0 => 1


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/28224#comment:3>

Django

未读,
2017年5月25日 08:18:182017/5/25
收件人 django-...@googlegroups.com
#28224: Test for SuspiciousOperation subclasses rather than SuspiciousOperation in

Django's tests
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Rajesh
Type: | Veeranki
Cleanup/optimization | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: exception classes | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/28224#comment:4>

Django

未读,
2017年5月25日 08:19:262017/5/25
收件人 django-...@googlegroups.com
#28224: Test for SuspiciousOperation subclasses rather than SuspiciousOperation in
Django's tests
-------------------------------------+-------------------------------------
Reporter: Mads Jensen | Owner: Rajesh
Type: | Veeranki
Cleanup/optimization | Status: closed

Component: Core (Other) | Version: master
Severity: Normal | Resolution: fixed

Keywords: exception classes | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"67e1afb4a8478af6725e45a9fdcd2a511b2eb005" 67e1afb4]:
{{{
#!CommitTicketReference repository=""
revision="67e1afb4a8478af6725e45a9fdcd2a511b2eb005"
Fixed #28224 -- Tested for SuspiciousOperation subclasses in Django's
tests.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28224#comment:5>

回复全部
回复作者
转发
0 个新帖子