Skipif no scipy
State: closed

- [ ] progress towards #18190 
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


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

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

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

```diff
@@            Coverage Diff             @@
##           master   #18794      +/-   ##
==========================================
- Coverage   91.63%   91.62%   -0.02%     
==========================================
  Files         154      154              
  Lines       51422    51428       +6     
==========================================
- Hits        47121    47120       -1     
- Misses       4301     4308       +7
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.49% <100%> (ø)` | :arrow_up: |
| #single | `40.83% <100%> (-0.1%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18794?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/\_test\_decorators.py](https://codecov.io/gh/pandas-dev/pandas/pull/18794/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvX3Rlc3RfZGVjb3JhdG9ycy5weQ==) | `94.54% <100%> (+0.66%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18794/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18794/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.68% <0%> (-0.11%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/18794/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `82.91% <0%> (+0.19%)` | :arrow_up: |

------

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

@jreback how would you feel if we got rid of a dedicated ``skip_if_no_scipy`` decorator? The current dedicated function goes through importing the ``stats``, ``sparse`` and ``interpolate`` subpackages. Looking at the SciPy source all three of those are available as far back as v0.6 released in 2007.

The test cases that use the existing function all seem to require just one and only one of those sub-packages, so we could either:

1. Be explicit about the sub package required (ex: ``skip_if_no('scipy.stats'``) OR
2. Simply do ``skip_if_no('scipy`)``, reasonably assuming the required sub-package is there
ok with removing extra decorators
in the one hand it is nice to have a dedicated function
if we r using it a lot but scipy skips are not so often
I'm OK to have this merged as is. Not sure the juice is worth the squeeze yet in going back and getting rid of that decorator, so I'll defer for now.

``tm.skip_if_no_package`` still needs to be replaced but that's already called out as a separate checklist item. While most calls of that can be replaced with the scipy decorator, there's one instance containing a ``max_version`` that isn't built out in the new module already, so I'd rather tackle that in another change.
thanks @WillAyd keep em coming!