Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#31544 closed Cleanup/optimization (wontfix)

Document input/output capturing utils in django.test.utils

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

comment:1 by Tim Graham, 4 years ago

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

comment:2 by Tim Graham, 4 years ago

Description: modified (diff)

comment:3 by Mariusz Felisiak, 4 years ago

Resolution: wontfix
Status: newclosed

I agree with Tim, we should advocate that Python make them officially supported. I added a ticket https://bugs.python.org/issue40557.

comment:4 by Adam Johnson, 4 years ago

Thanks. I thought of that, I just get a bit shy about opening up Python tickets.. :)

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