Opened 13 years ago
Closed 10 years ago
#17958 closed New feature (duplicate)
Add a capture_logging test util
Reported by: | Claude Paroz | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | logging |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
While working on silencing contrib.gis tests (to-be-created ticket), I find myself in need of a utility to capture logging during tests. This is the result this work.
Attachments (1)
Change History (6)
by , 13 years ago
Attachment: | capture_logging.diff added |
---|
comment:1 by , 13 years ago
to-be-created ticket is #17959 (which represents a real use case for this ticket).
comment:2 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 11 years ago
#19866 added a similar utility, but differs from this patch in several ways, one it was added as private API, not documented for use in other's tests. Second it took the approach close to mocking the logger via monkey-patch of a specific level method, rather than adding a stream to the logging machinery.
This should stay open as it has a different scope of packaging this sort of utility for public use - not something I feel strongly that Django needs to ship publicly, but not something I'm against either.
comment:4 by , 10 years ago
Patch needs improvement: | set |
---|
We resolved the linked ticket without this -- do we still want/need it?
In any case, I'm sure it needs to be updated to apply cleanly.
comment:5 by , 10 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Let's forget it for now. We'll see in the future if there is still some demand for it.
Add context manager for logging capture