Skip to content

Break apart test_frame.py and fix all flake8 warnings #12032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 14, 2016

Conversation

wesm
Copy link
Member

@wesm wesm commented Jan 13, 2016

@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.

@jreback
Copy link
Contributor

jreback commented Jan 13, 2016

lgtm at first glance.

@jreback jreback added Testing pandas testing functions or related to the test suite Code Style Code style, linting, code_checks labels Jan 13, 2016
@jreback jreback added this to the 0.18.0 milestone Jan 13, 2016
@wesm
Copy link
Member Author

wesm commented Jan 13, 2016

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

@jreback
Copy link
Contributor

jreback commented Jan 13, 2016

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

@wesm
Copy link
Member Author

wesm commented Jan 13, 2016

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

@wesm
Copy link
Member Author

wesm commented Jan 13, 2016

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

@wesm wesm changed the title WIP: reorganizing test_frame.py and fixing code style Break apart test_frame.py and fix all flake8 warnings Jan 13, 2016
@wesm
Copy link
Member Author

wesm commented Jan 13, 2016

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(-)

@jreback
Copy link
Contributor

jreback commented Jan 13, 2016

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

@wesm
Copy link
Member Author

wesm commented Jan 14, 2016

@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?

@wesm
Copy link
Member Author

wesm commented Jan 14, 2016

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

@jreback
Copy link
Contributor

jreback commented Jan 14, 2016

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

@wesm
Copy link
Member Author

wesm commented Jan 14, 2016

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

@jreback
Copy link
Contributor

jreback commented Jan 14, 2016

sure, merge on pass

@wesm
Copy link
Member Author

wesm commented Jan 14, 2016

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.

jreback added a commit that referenced this pull request Jan 14, 2016
Break apart test_frame.py and fix all flake8 warnings
@jreback jreback merged commit 1ae6384 into pandas-dev:master Jan 14, 2016
@jreback
Copy link
Contributor

jreback commented Jan 14, 2016

I usually just squash to a single commit and merge.

@wesm wesm deleted the tests/test-frame-reorg-1 branch January 16, 2016 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants