[test] replace capsys with the more refined CaptureStderr/CaptureStdout
Author: stas00
Pull request: yes

Now https://github.com/huggingface/transformers/pull/6231 has been merged, we can now do a more refined, more tightly scoped std stream captures as shown [here](https://github.com/huggingface/transformers/pull/6231#issuecomment-671789424)

otherwise no test functionality change.

Any CI fails are unrelated.


Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/6422?src=pr&el=h1) Report
> Merging [#6422](https://codecov.io/gh/huggingface/transformers/pull/6422?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/4ffea5ce2f4d154a3696b8fe2fb116fa09235700&el=desc) will **decrease** coverage by `2.51%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/6422/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/6422?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #6422      +/-   ##
==========================================
- Coverage   79.89%   77.37%   -2.52%     
==========================================
  Files         153      153              
  Lines       27902    27902              
==========================================
- Hits        22291    21588     -703     
- Misses       5611     6314     +703     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/6422?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/optimization.py](https://codecov.io/gh/huggingface/transformers/pull/6422/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9vcHRpbWl6YXRpb24ucHk=) | `25.55% <0.00%> (-70.00%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_distilbert.py](https://codecov.io/gh/huggingface/transformers/pull/6422/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9kaXN0aWxiZXJ0LnB5) | `34.11% <0.00%> (-63.30%)` | :arrow_down: |
| [src/transformers/pipelines.py](https://codecov.io/gh/huggingface/transformers/pull/6422/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9waXBlbGluZXMucHk=) | `26.98% <0.00%> (-52.81%)` | :arrow_down: |
| [src/transformers/optimization\_tf.py](https://codecov.io/gh/huggingface/transformers/pull/6422/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9vcHRpbWl6YXRpb25fdGYucHk=) | `33.33% <0.00%> (-24.33%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_auto.py](https://codecov.io/gh/huggingface/transformers/pull/6422/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9hdXRvLnB5) | `48.79% <0.00%> (-18.08%)` | :arrow_down: |
| [src/transformers/modeling\_auto.py](https://codecov.io/gh/huggingface/transformers/pull/6422/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19hdXRvLnB5) | `64.16% <0.00%> (-14.46%)` | :arrow_down: |
| [src/transformers/data/processors/squad.py](https://codecov.io/gh/huggingface/transformers/pull/6422/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9kYXRhL3Byb2Nlc3NvcnMvc3F1YWQucHk=) | `13.76% <0.00%> (-14.38%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_gpt2.py](https://codecov.io/gh/huggingface/transformers/pull/6422/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9ncHQyLnB5) | `65.68% <0.00%> (-6.16%)` | :arrow_down: |
| [src/transformers/modelcard.py](https://codecov.io/gh/huggingface/transformers/pull/6422/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGNhcmQucHk=) | `82.71% <0.00%> (-2.47%)` | :arrow_down: |
| [src/transformers/modeling\_distilbert.py](https://codecov.io/gh/huggingface/transformers/pull/6422/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19kaXN0aWxiZXJ0LnB5) | `96.19% <0.00%> (-1.64%)` | :arrow_down: |
| ... and [17 more](https://codecov.io/gh/huggingface/transformers/pull/6422/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/6422?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/huggingface/transformers/pull/6422?src=pr&el=footer). Last update [4ffea5c...bece6ba](https://codecov.io/gh/huggingface/transformers/pull/6422?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).