-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fixturize tests/frame/test_axis_select_reindex.py #25627
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #25627 +/- ##
=======================================
Coverage 91.26% 91.26%
=======================================
Files 173 173
Lines 52968 52968
=======================================
Hits 48339 48339
Misses 4629 4629
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #25627 +/- ##
=========================================
Coverage ? 91.83%
=========================================
Files ? 174
Lines ? 50643
Branches ? 0
=========================================
Hits ? 46510
Misses ? 4133
Partials ? 0
Continue to review full report at Codecov.
|
pandas/tests/frame/conftest.py
Outdated
@@ -127,6 +127,14 @@ def timezone_frame(): | |||
return df | |||
|
|||
|
|||
@pytest.fixture | |||
def datetime_series(): | |||
""" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
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. |
@jreback The fact that they are attributes of |
@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. |
+1 on reorg of fixtures later |
pandas/tests/frame/conftest.py
Outdated
@@ -127,6 +127,14 @@ def timezone_frame(): | |||
return df | |||
|
|||
|
|||
@pytest.fixture | |||
def datetime_series(): | |||
""" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
pandas/tests/frame/conftest.py
Outdated
@@ -127,6 +127,14 @@ def timezone_frame(): | |||
return df | |||
|
|||
|
|||
@pytest.fixture | |||
def datetime_series(): | |||
""" |
There was a problem hiding this comment.
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.
if you remove the datetime_series fixture and rebase would consider |
@jreback |
well, this would need a rebase and remove the added fixture; I am not sure I said to keep that fixtures, its pretty useless. |
Thanks for taking care of this! |
thanks @h-vetinari |
Picking up #22471 again. Needed to readd some fixtures that were removed by #24885.