This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Move captured_stdin(), captured_stdout(), and captured_stderr() to the public API.
Type: enhancement Stage:
Components: Tests Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: felixxm, terry.reedy
Priority: normal Keywords:

Created on 2020-05-08 05:12 by felixxm, last changed 2022-04-11 14:59 by admin.

Messages (4)
msg368419 - (view) Author: Mariusz Felisiak (felixxm) * Date: 2020-05-08 05:12
I would like to propose making test.support.captured_stdin(), captured_stdout(), and captured_stderr() public APIs with guaranteed stability.

These helpers are really useful and are stable for the last ~10 years.
msg368420 - (view) Author: Mariusz Felisiak (felixxm) * Date: 2020-05-08 05:12
I can prepare a patch.
msg368478 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-08 22:49
I am rather sure that test.support is going to remain private.  So the concrete proposal should be to move them into the unittest package somewhere, perhaps in a new unittest.utils/support/helpers module, for battle-tested helper functions.

I strongly suggest that you make such a proposal on the python-ideas list, both to get support from users and also from a coredev that might review and merge if approved.

A new module should require a PEP, which should include some criteria for what might go into such a module.  What some coredevs will rightly fear is an avalanche of proposals to various person's favorite thing from test.support, or even elsewhere.  Why these 3 things and not other things or even everything?  Take a look at PEP 1 for what should be covered even in a pre-PEP.
msg368481 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-08 22:55
The proposal should include the idea that the functions in test.support be replaced with

from unittest.helpers import *  # or
from unittest.helpers import captured_stdin, ...

so that a) no other changes need be made to existing tests and b) the possibility remains of someday wrapping or replacing the public version, again without necessarily changing existing tests.
History
Date User Action Args
2022-04-11 14:59:30adminsetgithub: 84737
2020-05-08 22:55:48terry.reedysetmessages: + msg368481
2020-05-08 22:49:08terry.reedysetnosy: + terry.reedy
messages: + msg368478
2020-05-08 05:12:39felixxmsetmessages: + msg368420
2020-05-08 05:12:03felixxmcreate