REF/TST: replace capture_stderr with pytest capsys fixture
State: closed

xref https://github.com/pandas-dev/pandas/pull/24489#pullrequestreview-188428229

separate PR to follow to replace `capture_stdout`

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

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24496?src=pr&el=h1) Report
> Merging [#24496](https://codecov.io/gh/pandas-dev/pandas/pull/24496?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/1ebfd8a9fda12cd68c3e068b777c7a0a2470dfaf?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #24496      +/-   ##
==========================================
- Coverage   92.31%    92.3%   -0.01%     
==========================================
  Files         166      166              
  Lines       52412    52405       -7     
==========================================
- Hits        48382    48375       -7     
  Misses       4030     4030
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.73% <ø> (-0.01%)` | :arrow_down: |
| #single | `43.05% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24496?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24496/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `87.68% <ø> (-0.08%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24496?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/24496?src=pr&el=footer). Last update [1ebfd8a...c54cf3e](https://codecov.io/gh/pandas-dev/pandas/pull/24496?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/24496?src=pr&el=h1) Report
> Merging [#24496](https://codecov.io/gh/pandas-dev/pandas/pull/24496?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/1ebfd8a9fda12cd68c3e068b777c7a0a2470dfaf?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #24496      +/-   ##
==========================================
- Coverage   92.31%    92.3%   -0.01%     
==========================================
  Files         166      166              
  Lines       52412    52405       -7     
==========================================
- Hits        48382    48375       -7     
  Misses       4030     4030
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.73% <ø> (-0.01%)` | :arrow_down: |
| #single | `43.05% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24496?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24496/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `87.68% <ø> (-0.08%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24496?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/24496?src=pr&el=footer). Last update [1ebfd8a...c54cf3e](https://codecov.io/gh/pandas-dev/pandas/pull/24496?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

thanks @simonjayhawkins 

*maybe* could consider adding a how-to (or just pointers to existing tests) in contributing.rst