CI: Check in the CI that assert_raises_regex is not being used
State: closed

Follow up of #23592.

As `assert_raises_regex`is now deprecated, add to the CI a check to fail if a PR uses it.


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

Comments:
> As assert_raises_regexis not deprecated, add to the CI a check to fail if a PR uses it.

@datapythonista : That's not true.  `assert_raises_regex` is [deprecated](https://github.com/pandas-dev/pandas/blob/58a59bd606911f11a4f679df18a00cfc25536c30/pandas/util/testing.py#L2576).  That's why I was saying that the need to check for usage was unnecessary.  Warnings will be issued if used.
We still need the check, in case it’s used in a test that’s skipped on the numpydev job.


________________________________
From: gfyoung <notifications@github.com>
Sent: Sunday, November 11, 2018 4:32 PM
To: pandas-dev/pandas
Cc: Tom Augspurger; Comment
Subject: Re: [pandas-dev/pandas] CI: Check in the CI that assert_raises_regex is not being used (#23627)


As assert_raises_regexis not deprecated, add to the CI a check to fail if a PR uses it.

@datapythonista<https://github.com/datapythonista> : That's not correct. assert_raises_regex is deprecated<https://github.com/pandas-dev/pandas/blob/58a59bd606911f11a4f679df18a00cfc25536c30/pandas/util/testing.py#L2576>. That's why I was saying that the need to check for usage was unnecessary.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://github.com/pandas-dev/pandas/pull/23627#issuecomment-437711494>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABQHIs6ADp5IiNxjJ4PNNWe1p0M4PuUzks5uuKWIgaJpZM4YYqgS>.

I meant `now` instead of `not`.

I don't understand what you mean, sorry. I think after all your work replacing `assert_raises_regex` by `pytest.raises` now we don't want anyone to use `assert_raises_regex` anymore, right?

If you agree with that, this PR what it does it just to fail the CI if anyone uses it in a PR. Doesn't this make sense?


lgtm merge on green 
you need ``--includes '.py --includes '*.pyx''`` in your grep

```
Check that the deprecated `assert_raises_regex` is not used (`pytest.raises(match=pattern)` should be used instead)
Binary file pandas/tests/util/__pycache__/test_testing.cpython-36-PYTEST.pyc matches
Binary file pandas/util/__pycache__/testing.cpython-36.pyc matches
Binary file pandas/util/__pycache__/testing.cpython-36.opt-2.pyc matches
Check that the deprecated `assert_raises_regex` is not used (`pytest.raises(match=pattern)` should be used instead) DONE
```
I just did `--exclude=.pyc`. I don't think it should be used in `.pyx` or others, but I guess it's saver. Do you think `--include=*.py` is better?
@datapythonista that's ok as well. I kind of slightly prefer the includes but prob doesn't make much difference here.
ping on green.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23627?src=pr&el=h1) Report
> Merging [#23627](https://codecov.io/gh/pandas-dev/pandas/pull/23627?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/58a59bd606911f11a4f679df18a00cfc25536c30?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #23627      +/-   ##
==========================================
+ Coverage   92.23%   92.23%   +<.01%     
==========================================
  Files         161      161              
  Lines       51288    51322      +34     
==========================================
+ Hits        47304    47337      +33     
- Misses       3984     3985       +1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.62% <ø> (ø)` | :arrow_up: |
| #single | `42.3% <ø> (+0.03%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23627?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/23627/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `89.29% <0%> (-0.59%)` | :arrow_down: |
| [pandas/core/tools/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/23627/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvdGltZWRlbHRhcy5weQ==) | `98.03% <0%> (-0.15%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23627/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `96.12% <0%> (-0.02%)` | :arrow_down: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23627/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `98.44% <0%> (-0.01%)` | :arrow_down: |
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/23627/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `95.08% <0%> (+1.29%)` | :arrow_up: |

------

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