Opened 8 years ago
Last modified 11 months ago
#27447 new New feature
Provide an easy way to test sending of signals
Reported by: | James Bennett | Owned by: | |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Ülgen Sarıkavak | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | |||
Description ¶
Currently, when writing tests for an application that sends signals, there's no easy built-in way to test the sending of signals.
A simple solution would be to add a context-manager assertion that can check a signal was sent and received keyword arguments with certain names, and then further inspection of the received arguments could be done inside the with
block. For example:
with self.AssertSignalSent(some_signal, required_kwargs=['my_kwarg']): # ...do stuff...
According to the ticket's flags, the next step(s) to move this issue forward are:
- To improve the patch as described in the pull request review comments or on this ticket, then uncheck "Patch needs improvement".
If creating a new pull request, include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Change History (9)
comment:1 by , 8 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Version: | 1.10 → master |
comment:2 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 8 years ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
comment:6 by , 8 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:7 by , 8 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Ready for checkin → Accepted |
The code is looking good. Let's wait for a documentation review from a native speaker.
comment:8 by , 8 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
We're now at four other members of -core reviewed, all concerns addressed. Speak now or implement fixes for your critique later.
comment:9 by , 8 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
I left some comments on the PR. When James is finished with the updates, I'll add a commit to the branch that makes use of this assertion in Django's test suite.
comment:10 by , 2 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:11 by , 11 months ago
Cc: | added |
---|
WIP PR