[Suggestion] Use a namedtuple for capsys results #2879
Labels
good first issue
easy issue that is friendly to new contributor
type: enhancement
new feature or API change, should be merged into features branch
Currently, the
capsys
fixture'sreadouterr()
method returns a tuple with (stdout, stderr) results.Usage will look something like this:
My suggestion would be to return a
namedtuple
instead, so the attributes can be accessed by nameWhich could be achieved by wrapping the result with something like:
This would be pretty straightforward, and still fully compatible with existing code using tuples either for index access or unpacking.
The text was updated successfully, but these errors were encountered: