TST: Use fixtures in indexes common tests
State: closed

- [x] closes #16835
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Not sure if there is a better way to define fixture params since they're essentially the indexes defined in `setup_method`. Also thinking about adding an id to each param so the output doesn't look like:

```
test_base.py::TestMixedIntIndex::test_sort[index0] <- pandas/tests/indexes/common.py PASSED
test_base.py::TestMixedIntIndex::test_sort[index1] <- pandas/tests/indexes/common.py PASSED
test_base.py::TestMixedIntIndex::test_sort[index2] <- pandas/tests/indexes/common.py PASSED
test_base.py::TestMixedIntIndex::test_sort[index3] <- pandas/tests/indexes/common.py PASSED
...
```

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

Comments:
can you update
Hello @GuessWhoSamFoo! Thanks for updating the PR.













Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on September 24, 2017 at 22:38 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=h1) Report
> Merging [#17622](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/8276a420a36c26eaab38856177023cb064963f19?src=pr&el=desc) will **increase** coverage by `0.03%`.
> The diff coverage is `92.85%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17622      +/-   ##
==========================================
+ Coverage    91.2%   91.23%   +0.03%     
==========================================
  Files         163      163              
  Lines       49637    49806     +169     
==========================================
+ Hits        45269    45442     +173     
+ Misses       4368     4364       -4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.03% <92.85%> (+0.06%)` | :arrow_up: |
| #single | `40.32% <85.71%> (+0.07%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tests/indexes/conftest.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL3Rlc3RzL2luZGV4ZXMvY29uZnRlc3QucHk=) | `96.77% <92.85%> (ø)` | |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/accessor.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYWNjZXNzb3IucHk=) | `93.65% <0%> (-6.35%)` | :arrow_down: |
| [pandas/core/indexes/category.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9jYXRlZ29yeS5weQ==) | `97.74% <0%> (-0.81%)` | :arrow_down: |
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `92.85% <0%> (-0.72%)` | :arrow_down: |
| [pandas/core/dtypes/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbW1vbi5weQ==) | `94.45% <0%> (-0.41%)` | :arrow_down: |
| [pandas/core/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY2F0ZWdvcmljYWwucHk=) | `95.28% <0%> (-0.31%)` | :arrow_down: |
| [pandas/io/excel.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2lvL2V4Y2VsLnB5) | `80.37% <0%> (-0.18%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.73% <0%> (-0.14%)` | :arrow_down: |
| [pandas/io/packers.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhY2tlcnMucHk=) | `88.19% <0%> (-0.04%)` | :arrow_down: |
| ... and [21 more](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17622?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/17622?src=pr&el=footer). Last update [8276a42...6ea1c70](https://codecov.io/gh/pandas-dev/pandas/pull/17622?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/17622?src=pr&el=h1) Report
> Merging [#17622](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/8276a420a36c26eaab38856177023cb064963f19?src=pr&el=desc) will **increase** coverage by `0.03%`.
> The diff coverage is `92.85%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17622      +/-   ##
==========================================
+ Coverage    91.2%   91.23%   +0.03%     
==========================================
  Files         163      163              
  Lines       49637    49806     +169     
==========================================
+ Hits        45269    45442     +173     
+ Misses       4368     4364       -4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.03% <92.85%> (+0.06%)` | :arrow_up: |
| #single | `40.32% <85.71%> (+0.07%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tests/indexes/conftest.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL3Rlc3RzL2luZGV4ZXMvY29uZnRlc3QucHk=) | `96.77% <92.85%> (ø)` | |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/accessor.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYWNjZXNzb3IucHk=) | `93.65% <0%> (-6.35%)` | :arrow_down: |
| [pandas/core/indexes/category.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9jYXRlZ29yeS5weQ==) | `97.74% <0%> (-0.81%)` | :arrow_down: |
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `92.85% <0%> (-0.72%)` | :arrow_down: |
| [pandas/core/dtypes/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbW1vbi5weQ==) | `94.45% <0%> (-0.41%)` | :arrow_down: |
| [pandas/core/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY2F0ZWdvcmljYWwucHk=) | `95.28% <0%> (-0.31%)` | :arrow_down: |
| [pandas/io/excel.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2lvL2V4Y2VsLnB5) | `80.37% <0%> (-0.18%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.73% <0%> (-0.14%)` | :arrow_down: |
| [pandas/io/packers.py](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhY2tlcnMucHk=) | `88.19% <0%> (-0.04%)` | :arrow_down: |
| ... and [21 more](https://codecov.io/gh/pandas-dev/pandas/pull/17622?src=pr&el=tree-more) | |

------

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

thanks!

just added about 1000 tests!

ideally would like to add more local conftests as needed similar to this. IOW there are other places where we need fixtures similar to this. things like timeseries offsets and others, if you are interested.
also in pandas/test_base where I think. if you want to search for and make an issue of places to correct would be great (or just send PR's!)