MAINT: Remove pytest.warns in tests
State: closed

Per discussion in #18258, we are prohibiting its use in tests, at least for the time being.

Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Code Style
description: Code style, linting, code_checks

Comments:
I added the linting but will push fix in second commit once I confirm linting works.
@gfyoung this needs to fix the test, no? ) (or maybe you are just testing if this will fail)

```
(pandas) bash-3.2$ grep -r -E --include '*.py' 'pytest\.warns' pandas/tests/
pandas/tests//series/test_timeseries.py:        with pytest.warns(FutureWarning):
```
> (or maybe you are just testing if this will fail)

@jreback : Yes, that's the plan 😉   You can see that it worked.

https://travis-ci.org/pandas-dev/pandas/jobs/331740919#L3018
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19341?src=pr&el=h1) Report
> Merging [#19341](https://codecov.io/gh/pandas-dev/pandas/pull/19341?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/2952fbd556e1bc4b5fac70c727652b5419e8e096?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #19341      +/-   ##
==========================================
- Coverage   91.57%   91.54%   -0.03%     
==========================================
  Files         150      150              
  Lines       48702    48702              
==========================================
- Hits        44597    44585      -12     
- Misses       4105     4117      +12
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.91% <ø> (-0.03%)` | :arrow_down: |
| #single | `41.71% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19341?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/19341/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `65.22% <0%> (-1.74%)` | :arrow_down: |

------

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

@jreback : Lint error has been patched as planned.  PTAL.
thanks @gfyoung 

I would not necessarily be averse to changing to use ``pytest.warns`` generally. I don't know if it has any diffs with what we have now.
> I would not necessarily be averse to changing to use pytest.warns generally. I don't know if it has any diffs with what we have now.

The main difference (I think) is that ours has `check_stacklevel` for deprecation/future warnings