Skip to content
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

Fixturize tests/frame/test_axis_select_reindex.py #25627

Merged
merged 7 commits into from
Jun 28, 2019

Conversation

h-vetinari
Copy link
Contributor

Picking up #22471 again. Needed to readd some fixtures that were removed by #24885.

@codecov
Copy link

codecov bot commented Mar 10, 2019

Codecov Report

Merging #25627 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #25627   +/-   ##
=======================================
  Coverage   91.26%   91.26%           
=======================================
  Files         173      173           
  Lines       52968    52968           
=======================================
  Hits        48339    48339           
  Misses       4629     4629
Flag Coverage Δ
#multiple 89.83% <ø> (ø) ⬆️
#single 41.71% <ø> (ø) ⬆️

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 e28ae70...aa312da. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 10, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@87d7cdf). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #25627   +/-   ##
=========================================
  Coverage          ?   91.83%           
=========================================
  Files             ?      174           
  Lines             ?    50643           
  Branches          ?        0           
=========================================
  Hits              ?    46510           
  Misses            ?     4133           
  Partials          ?        0
Flag Coverage Δ
#multiple 90.37% <ø> (?)
#single 41.69% <ø> (?)

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 87d7cdf...8afc817. Read the comment docs.

@@ -127,6 +127,14 @@ def timezone_frame():
return df


@pytest.fixture
def datetime_series():
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

this fixture itself is not very useful, however, possibly a fixture that is a float_frame but uses this an index might be

Copy link
Member

Choose a reason for hiding this comment

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

Yea I would agree with this comment. It also seems strange to put a fixture in this conftest which returns a series, as that could either create duplication or friction with the conftest for the series directory.

Any way to do what @jreback suggests above here?

Copy link
Contributor Author

@h-vetinari h-vetinari Mar 19, 2019

Choose a reason for hiding this comment

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

@h-vetinari: @jreback Can't do 3 things at the same time reasonably.
You're already requesting to do fixturization and renaming at the same time, let's keep the reorg for later. Also, case in point about the necessity of (some of) the fixtures re-added here: #25635

@jreback: +1 on reorg of fixtures later

@WillAyd, of course both of you are right. But the quasi-fixtures from tests.frame.common.TestData that are supposed to be translated already have this (as self.ts1).

I guess I should have pushed back harder against #24885, because datetime_series was already in tests.frame.conftest (since #22236) precisely for this translation. There's a limit to how many balls any one PR should have up in the air, and fixturization plus renaming is more than enough IMO.

def test_align(self):
af, bf = self.frame.align(self.frame)
assert af._data is not self.frame._data
def test_align(self, float_frame, int_frame, float_string_frame,
Copy link
Contributor

Choose a reason for hiding this comment

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

if you are adding many fixtures to a test, would rather use a parametrization of those fixtures, or create separate tests

@jreback jreback added the Testing pandas testing functions or related to the test suite label Mar 10, 2019
@jreback
Copy link
Contributor

jreback commented Mar 10, 2019

i would like a more coherent strategy that just adding singleton fixtures, so better to show that a fixture is useful across multiple files first.

@h-vetinari
Copy link
Contributor Author

@jreback
I get that #22236 and #22471 are a while back - your hard requirement was fixturization of all frame tests. All the existing fixtures already exists as "quasi-fixtures" in tests.frame.common.TestData, and #22471 is purely for translating.

The fact that they are attributes of TestData is enough of a reason to translate them to fixtures (which #22236 did, until @jbrockmendel deleted some that weren't used yet due to the "good first issue" losing its drive after a while).

@jreback
Copy link
Contributor

jreback commented Mar 10, 2019

@h-vetinari I think the approach here needs to change. Let's put fixtures inside the modules that use them. Once they are used by at least 2 but preferable more test modules, then we can pull them out.

The problem is we have a hard time discovering cross modules what fixtures are useful an which are not. Since the code currently is not updated to use fixtures at all.

@h-vetinari
Copy link
Contributor Author

@jreback
Can't do 3 things at the same time reasonably.

You're already requesting to do fixturization and renaming at the same time, let's keep the reorg for later. Also, case in point about the necessity of (some of) the fixtures re-added here: #25635

@jreback
Copy link
Contributor

jreback commented Mar 10, 2019

+1 on reorg of fixtures later

@h-vetinari
Copy link
Contributor Author

@jreback @WillAyd
Thanks for all the reviews. This one seems to have slipped through the last round. ;-)

@@ -127,6 +127,14 @@ def timezone_frame():
return df


@pytest.fixture
def datetime_series():
"""
Copy link
Member

Choose a reason for hiding this comment

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

Yea I would agree with this comment. It also seems strange to put a fixture in this conftest which returns a series, as that could either create duplication or friction with the conftest for the series directory.

Any way to do what @jreback suggests above here?

Copy link
Contributor Author

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

PTAL

@@ -127,6 +127,14 @@ def timezone_frame():
return df


@pytest.fixture
def datetime_series():
"""
Copy link
Contributor Author

@h-vetinari h-vetinari Mar 19, 2019

Choose a reason for hiding this comment

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

@h-vetinari: @jreback Can't do 3 things at the same time reasonably.
You're already requesting to do fixturization and renaming at the same time, let's keep the reorg for later. Also, case in point about the necessity of (some of) the fixtures re-added here: #25635

@jreback: +1 on reorg of fixtures later

@WillAyd, of course both of you are right. But the quasi-fixtures from tests.frame.common.TestData that are supposed to be translated already have this (as self.ts1).

I guess I should have pushed back harder against #24885, because datetime_series was already in tests.frame.conftest (since #22236) precisely for this translation. There's a limit to how many balls any one PR should have up in the air, and fixturization plus renaming is more than enough IMO.

@jreback
Copy link
Contributor

jreback commented Apr 20, 2019

if you remove the datetime_series fixture and rebase would consider

@h-vetinari
Copy link
Contributor Author

@jreback
This is updated and green. About the datetime_series fixture, please see my comment (that you had already agreed to), that these PRs should be translation only, and not rewrite tests:

@jreback
Copy link
Contributor

jreback commented Jun 27, 2019

well, this would need a rebase and remove the added fixture; I am not sure I said to keep that fixtures, its pretty useless.

@jreback jreback added this to the 0.25.0 milestone Jun 27, 2019
@h-vetinari
Copy link
Contributor Author

Thanks for taking care of this!

@jreback jreback merged commit bd72942 into pandas-dev:master Jun 28, 2019
@jreback
Copy link
Contributor

jreback commented Jun 28, 2019

thanks @h-vetinari

@h-vetinari h-vetinari deleted the fixturize_frame_axis branch June 28, 2019 12:28
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.

3 participants