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)

capture_logging.diff (3.8 KB ) - added by Claude Paroz 13 years ago.
Add context manager for logging capture

Download all attachments as: .zip

Change History (6)

by Claude Paroz, 13 years ago

Attachment: capture_logging.diff added

Add context manager for logging capture

comment:1 by Claude Paroz, 13 years ago

to-be-created ticket is #17959 (which represents a real use case for this ticket).

comment:2 by Preston Holmes, 13 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Preston Holmes, 12 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 Tim Graham, 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 Claude Paroz, 10 years ago

Resolution: duplicate
Status: newclosed

Let's forget it for now. We'll see in the future if there is still some demand for it.

Note: See TracTickets for help on using tickets.
Back to Top