Break apart test_frame.py and fix all flake8 warnings
State: closed

@jreback I re-enabled flake8 checking for unused imports. We should be explicit about what imports are part of a module API (and those warnings explicitly suppressed with `# noqa`) and delete all unused imports. 


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

Comments:
lgtm at first glance.

What's the story with the pickle-related test failures?

aren't any in master - do u have a run where something fails?

OK, I'm done, finally. 

before

```
$ nosetests -A "not slow" pandas/tests/test_frame.py 
....................../home/wesm/anaconda3/lib/python3.5/site-packages/numpy/core/_methods.py:59: RuntimeWarning: Mean of empty slice.
  warnings.warn("Mean of empty slice.", RuntimeWarning)
.............................................................................................................................................................../home/wesm/code/pandas/pandas/tests/test_frame.py:8197: RuntimeWarning: Cannot compare type 'Timestamp' with type 'str', sort order is undefined for incomparable objects
  colcorr = a.corrwith(b, axis=0)
............................................................................................................................................................................................S..................................................S........................................................................................................................................................................................................................................................................................................SS.....S...SS.......S.S.......................SS.....S...SS.......S.S..............SS..SS..............................
----------------------------------------------------------------------
Ran 836 tests in 69.212s

OK (SKIP=20)
```

after

```
$ nosetests -A "not slow" pandas/tests/frame
...................................../home/wesm/code/pandas/pandas/tests/frame/test_analytics.py:184: RuntimeWarning: Cannot compare type 'Timestamp' with type 'str', sort order is undefined for incomparable objects
  colcorr = a.corrwith(b, axis=0)
.....................................................S............................/home/wesm/anaconda3/lib/python3.5/site-packages/numpy/core/_methods.py:59: RuntimeWarning: Mean of empty slice.
  warnings.warn("Mean of empty slice.", RuntimeWarning)
...................................................................................................................................................................................................................................................................................................................................................................................................................S.............................................SS.....S...SS.......S.S.......................SS.....S...SS.......S.S.................................................................................................................................................................
----------------------------------------------------------------------
Ran 798 tests in 39.338s

OK (SKIP=16)
```

30 second gain is pretty good; mostly by trimming unnecessary `setUp` work

I seem to have somehow dropped 38 unit tests, so let me figure out if I lost any real test code (there were a bunch of empty test cases) by accident

These are the only test names that aren't being run in the refactored version:
- test_dtypes: RENAMED
- test_getitem_boolean_missing: EMPTY, removed
- test_interpolate: EMPTY, removed
- test_setitem_boolean_missing: EMPTY, removed
- test_setitem_fancy_exception: EMPTY, removed
- test_to_recods_index_name: RENAMED (fixed typo)

So I think we are good to go if/when Jenkins passes

I guess this patch broke GitHub. here's the diff stats i'm seeing

```
$ git diff master --stat
 pandas/sparse/tests/test_sparse.py             |     6 +-
 pandas/tests/frame/__init__.py                 |     0
 pandas/tests/frame/common.py                   |   141 +
 pandas/tests/frame/test_alter_axes.py          |   620 +
 pandas/tests/frame/test_analytics.py           |  2268 ++++
 pandas/tests/frame/test_apply.py               |   402 +
 pandas/tests/frame/test_axis_select_reindex.py |   808 ++
 pandas/tests/frame/test_block_internals.py     |   532 +
 pandas/tests/frame/test_combine_concat.py      |   455 +
 pandas/tests/frame/test_constructors.py        |  1997 ++++
 pandas/tests/frame/test_convert_to.py          |   174 +
 pandas/tests/frame/test_dtypes.py              |   396 +
 pandas/tests/frame/test_indexing.py            |  2600 +++++
 pandas/tests/frame/test_misc_api.py            |   487 +
 pandas/tests/frame/test_missing.py             |   427 +
 pandas/tests/frame/test_mutate_columns.py      |   221 +
 pandas/tests/frame/test_nonunique_indexes.py   |   454 +
 pandas/tests/frame/test_operators.py           |  1171 ++
 pandas/tests/frame/test_query_eval.py          |  1087 ++
 pandas/tests/frame/test_replace.py             |  1055 ++
 pandas/tests/frame/test_repr_info.py           |   377 +
 pandas/tests/frame/test_reshape.py             |   570 +
 pandas/tests/frame/test_sorting.py             |   473 +
 pandas/tests/frame/test_subclass.py            |   126 +
 pandas/tests/frame/test_timeseries.py          |   338 +
 pandas/tests/frame/test_to_csv.py              |  1110 ++
 pandas/tests/test_frame.py                     | 17190 ----------------------------
 setup.cfg                                      |     2 +-
 setup.py                                       |     1 +
 29 files changed, 18295 insertions(+), 17193 deletions(-)
```

> Sorry, we could not display the entire diff because it was too big.

@jreback here's an example of what I was talking about

https://travis-ci.org/wesm/pandas/jobs/102231014

any idea what is going on there?

It has something to do with the Travis configuration for personal branch test runs

@wesm that is very weird. That occurs only on your personal travis-ci ? (but ok on pydata/pandas)?

Seems that way. If this build passes, recommend merging soon to avoid too many merge conflicts

sure, merge on pass

Bombs away. What tool are you using for squash-merging nowadays? A lot of Apache projects have moved to cherry-pick only with no merge commits. 

I usually just squash to a single commit and merge.