Skip to content

TST: Fix indexes test inheritance / fixturization #23825

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
Nov 21, 2018

Conversation

TomAugspurger
Copy link
Contributor

Closes #23746

Before:

7355 passed, 852 skipped, 5 xfailed, 13 warnings in 75.20 seconds

After:

5740 passed, 724 skipped, 5 xfailed, 12 warnings in 67.73 seconds 

@TomAugspurger TomAugspurger added the Testing pandas testing functions or related to the test suite label Nov 20, 2018
@TomAugspurger TomAugspurger added this to the 0.24.0 milestone Nov 20, 2018
@pep8speaks
Copy link

Hello @TomAugspurger! Thanks for submitting the PR.

@TomAugspurger TomAugspurger changed the title TST: Fix test inheritence / fixturization TST: Fix indexes test inheritence / fixturization Nov 20, 2018
@TomAugspurger TomAugspurger changed the title TST: Fix indexes test inheritence / fixturization TST: Fix indexes test inheritance / fixturization Nov 20, 2018
@codecov
Copy link

codecov bot commented Nov 20, 2018

Codecov Report

Merging #23825 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #23825      +/-   ##
==========================================
- Coverage   92.29%   92.29%   -0.01%     
==========================================
  Files         161      161              
  Lines       51493    51490       -3     
==========================================
- Hits        47524    47521       -3     
  Misses       3969     3969
Flag Coverage Δ
#multiple 90.68% <ø> (-0.01%) ⬇️
#single 42.32% <ø> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/io/parsers.py 95.55% <0%> (-0.02%) ⬇️
pandas/core/base.py 97.61% <0%> (ø) ⬆️
pandas/core/frame.py 97.02% <0%> (ø) ⬆️
pandas/core/arrays/sparse.py 91.94% <0%> (ø) ⬆️
pandas/core/indexes/base.py 96.48% <0%> (ø) ⬆️
pandas/core/series.py 93.68% <0%> (ø) ⬆️
pandas/util/testing.py 86.09% <0%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 99df7da...b99cde7. Read the comment docs.

Copy link
Member

@jschendel jschendel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple comments not explicitly related to the diff, but in the spirit of the issue being resolved:

I think test_unique_na can be moved from common.py to test_base.py: this test doesn't look to be taking advantage of inheritance at all, and appears to be exactly the same each time it's run by child classes inheriting from Base.

Both test_has_duplicates and test_duplicated in common.py are still using the indices fixture. It doesn't look like they're causing an excess number of tests to be fully run, as these tests have a pytest.skip baked in to skip cases when indices doesn't match the type of index in the child class. This would be causing an excess of tests being skipped though, and is kind of a gross pattern. Would be fine leaving this as a follow up if that'd be preferred; seems like cleaning up these two tests could be in "good first issue" territory (or maybe a "good second issue" due to some complexity being present).

@TomAugspurger
Copy link
Contributor Author

I think test_unique_na can be moved from common.py to test_base.py

done.

Both test_has_duplicates and test_duplicated in common.py are still using the indices fixture.

hmm yes. As soon as I saw them using self._holder, I moved on from those tests. But those are indeed just skipping. I fixed this in aba63da, if you could double check my work. I think that type(indices) is just fine for all these tests.

$ pytest pandas/tests/indexes/test_common.py -k test_duplicated -v
=================================================================== test session starts ====================================================================
platform darwin -- Python 3.7.0, pytest-3.10.0, py-1.6.0, pluggy-0.7.1 -- /Users/taugspurger/Envs/pandas-dev/bin/python3
cachedir: .pytest_cache
rootdir: /Users/taugspurger/sandbox/pandas, inifile: setup.cfg
plugins: xdist-1.23.2, repeat-0.7.0, forked-0.2, faulthandler-1.5.0, cov-2.6.0, hypothesis-3.59.1
collected 392 items / 350 deselected

pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index0-first] PASSED                                                                [  2%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index0-last] PASSED                                                                 [  4%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index0-False] PASSED                                                                [  7%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index1-first] PASSED                                                                [  9%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index1-last] PASSED                                                                 [ 11%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index1-False] PASSED                                                                [ 14%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[DatetimeIndex-first] PASSED                                                         [ 16%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[DatetimeIndex-last] PASSED                                                          [ 19%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[DatetimeIndex-False] PASSED                                                         [ 21%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[PeriodIndex-first] PASSED                                                           [ 23%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[PeriodIndex-last] PASSED                                                            [ 26%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[PeriodIndex-False] PASSED                                                           [ 28%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[TimedeltaIndex-first] PASSED                                                        [ 30%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[TimedeltaIndex-last] PASSED                                                         [ 33%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[TimedeltaIndex-False] PASSED                                                        [ 35%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Int64Index0-first] PASSED                                                           [ 38%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Int64Index0-last] PASSED                                                            [ 40%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Int64Index0-False] PASSED                                                           [ 42%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[UInt64Index-first] PASSED                                                           [ 45%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[UInt64Index-last] PASSED                                                            [ 47%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[UInt64Index-False] PASSED                                                           [ 50%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[RangeIndex-first] SKIPPED                                                           [ 52%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[RangeIndex-last] SKIPPED                                                            [ 54%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[RangeIndex-False] SKIPPED                                                           [ 57%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Float64Index-first] PASSED                                                          [ 59%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Float64Index-last] PASSED                                                           [ 61%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Float64Index-False] PASSED                                                          [ 64%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index2-first] PASSED                                                                [ 66%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index2-last] PASSED                                                                 [ 69%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index2-False] PASSED                                                                [ 71%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[CategoricalIndex-first] PASSED                                                      [ 73%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[CategoricalIndex-last] PASSED                                                       [ 76%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[CategoricalIndex-False] PASSED                                                      [ 78%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index3-first] SKIPPED                                                               [ 80%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index3-last] SKIPPED                                                                [ 83%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Index3-False] SKIPPED                                                               [ 85%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[MultiIndex-first] SKIPPED                                                           [ 88%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[MultiIndex-last] SKIPPED                                                            [ 90%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[MultiIndex-False] SKIPPED                                                           [ 92%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Int64Index1-first] PASSED                                                           [ 95%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Int64Index1-last] PASSED                                                            [ 97%]
pandas/tests/indexes/test_common.py::TestCommon::test_duplicated[Int64Index1-False] PASSED                                                           [100%]

@jreback
Copy link
Contributor

jreback commented Nov 21, 2018

yeah this is ok. we need to finish moving to all fixtures from the inhertence setup of the original (might even be an open issue about this).

@jreback jreback merged commit 6e932f8 into pandas-dev:master Nov 21, 2018
@jreback
Copy link
Contributor

jreback commented Nov 21, 2018

thanks

Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants