MAINT: Strip internals from TestCase class
State: closed

`TestCase` is a vestige from the `nosetest` framework.  We want to discourage usage of `self.*` method calls under our new `pytest` framework, so this PR strips as much as possible from the class.

Partially addresses #15990.

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

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

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

```diff
@@            Coverage Diff             @@
##           master   #16016      +/-   ##
==========================================
- Coverage      91%   90.99%   -0.01%     
==========================================
  Files         153      153              
  Lines       50481    50469      -12     
==========================================
- Hits        45938    45926      -12     
  Misses       4543     4543
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.76% <100%> (-0.01%)` | :arrow_down: |
| #single | `40.44% <66.66%> (-0.01%)` | :arrow_down: |

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

------

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

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

```diff
@@            Coverage Diff             @@
##           master   #16016      +/-   ##
==========================================
- Coverage   90.99%   90.99%   -0.01%     
==========================================
  Files         154      154              
  Lines       50484    50471      -13     
==========================================
- Hits        45940    45928      -12     
+ Misses       4544     4543       -1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.76% <100%> (-0.01%)` | :arrow_down: |
| #single | `40.44% <66.66%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16016?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/decorators.py](https://codecov.io/gh/pandas-dev/pandas/pull/16016?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvZGVjb3JhdG9ycy5weQ==) | `65.3% <ø> (ø)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/16016?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `80.78% <100%> (-0.23%)` | :arrow_down: |
| [pandas/core/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/16016?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tbW9uLnB5) | `91.03% <0%> (+0.34%)` | :arrow_up: |

------

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

An alternative would be to keep it as class methods, but remove the `unittest.TestCase` inheritance (just pointing out, I am personally OK with moving from `self.` to `tm.`)
can you rebase.

lgtm otherwise.
> An alternative would be to keep it as class methods, but remove the unittest.TestCase inheritance (just pointing out, I am personally OK with moving from self. to tm.)

this is a precursor step to this. That's the goal.
> this is a precursor step to this. That's the goal.

No, I mean that, if `TestCase` no longer inherits from `unittest.TestCase`, you can keep using `self.`, so what I mean is that this is not a necessary precursor towards that goal
@jorisvandenbossche : Perhaps, but why should we though?  These methods were never really implemented as instance methods in the first place.
yeah I think we should move aways from using ``self`` entirely for actually testing things (keep state is fine).
@jreback , @jorisvandenbossche : Rebased, all green, and ready to merge.
thanks!