Opened 4 years ago

Last modified 4 years ago

#31544 closed Cleanup/optimization

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

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

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 https://github.com/django/django/commit/6dbe979b4d9396e1b307c7d27388c97c13beb21c .

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 (0)

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