TST: Add test decorators for redirecting stdout and stderr
State: closed

Add testing decorators for redirecting `stdout` and `stderr`.

xref <a href="https://github.com/pandas-dev/pandas/pull/15925#discussion_r110283696">#15925 (comment)</a>

Labels:
name: Testing
description: pandas testing functions or related to the test suite

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=h1) Report
> Merging [#15952](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/88f585155b6cae58b10f875c481871d510b8c591?src=pr&el=desc) will **increase** coverage by `0.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/15952/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #15952      +/-   ##
==========================================
+ Coverage   90.99%      91%   +0.01%     
==========================================
  Files         145      145              
  Lines       49570    49576       +6     
==========================================
+ Hits        45106    45118      +12     
+ Misses       4464     4458       -6
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.77% <100%> (+0.01%)` | :arrow_up: |
| #single | `40.57% <73.33%> (+0.01%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/decorators.py](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvZGVjb3JhdG9ycy5weQ==) | `65.3% <100%> (+3.04%)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `81.13% <100%> (+0.24%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=footer). Last update [88f5851...9edafd9](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=h1) Report
> Merging [#15952](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/0aef74fdf1e943f058aa185f47e322aafeeee002?src=pr&el=desc) will **increase** coverage by `0.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/15952/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #15952      +/-   ##
==========================================
+ Coverage   90.99%      91%   +0.01%     
==========================================
  Files         145      145              
  Lines       49570    49576       +6     
==========================================
+ Hits        45106    45118      +12     
+ Misses       4464     4458       -6
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.77% <100%> (+0.01%)` | :arrow_up: |
| #single | `40.57% <73.33%> (+0.01%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/decorators.py](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvZGVjb3JhdG9ycy5weQ==) | `65.3% <100%> (+3.04%)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `81.13% <100%> (+0.24%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=footer). Last update [0aef74f...82e11c1](https://codecov.io/gh/pandas-dev/pandas/pull/15952?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
thanks @gfyoung !