stdio-mgr
is maintained by Brian Skinn (Blog) (Twitter).
Both the standard library (via the contextlib
module) and pytest
provide mechanisms for capturing/mocking sys.stdout
and sys.stderr
. However, neither provides functionality for mocking sys.stdin
, and the usage of both can tend to be verbose. Thus, stdio-mgr
was originally created with two main goals in mind:
- Providing a mock for
sys.stdin
, in particular one with the capability to: a) Enable dynamic addition of text to the mocked input, and b) 'Tee' the content read tosys.stdout
(also mocked) in order to mimic what would be observed by a user at the console. - Implementing a concise, simultaneous mock for all of
sys.stdin
,sys.stdout
, andsys.stderr
These goals were achieved in v1.x, authored by Brian Skinn, and enabled direct testing of CLI logic involving user input.
stdio-mgr
v2, under active development as of 30 Aug 2019, aims to significantly expand the capabilities and correctness of the mocked stdio streams. John Vandenberg is leading these efforts. See the CHANGELOG (eventually) for details of added features, changed behavior/API, etc.