Opened 5 years ago

Last modified 5 years ago

#31544 closed Cleanup/optimization

Document input/output capturing utils in django.test.utils — at Version 2

Reported by: Adam Johnson Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

django.test.utils contains some useful helpers for input/output capturing:

  • captured_stdin
  • captured_stderr
  • captured_stdout

These can be useful for testing Django applications too, allowing users to avoid reinventing the wheel with mock.patch. They've been stable for a long time, remaining unchanged since their addition in 5 years ago in 6dbe979b4d9396e1b307c7d27388c97c13beb21c (#23930).

They're copied from Python's test.support where they've also not been changed in a long time, but this module explicitly makes no backwards compatibility guarantees. I think we could help Django users with stability and discoverability by making them a public API.

Change History (2)

comment:1 by Tim Graham, 5 years ago

It could be better to advocate that Python (rather than Django) make these public APIs.

comment:2 by Tim Graham, 5 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top