Skip to content

TST/CLN: Remove more seldom used fixtures #56625

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 17 commits into from
Jan 3, 2024

Conversation

mroeschke
Copy link
Member

No description provided.

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Dec 26, 2023
@mroeschke mroeschke added this to the 3.0 milestone Dec 26, 2023
@lithomas1 lithomas1 modified the milestones: 3.0, 2.3 Dec 29, 2023
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

seems pretty reasonable to me. out of curiosity how are you identifying these?



@pytest.fixture
def filepath_or_buffer(filepath_or_buffer_id, tmp_path):
Copy link
Member

Choose a reason for hiding this comment

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

I am surprised this is only used in one place - do we not have something similar elsewhere already?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixture-wise I don't think so. But I think I've seen similar testing over string-path, file-obj-path, buffer in other tests. I can try to track those down and fixture-ize in a followup

@@ -2668,7 +2422,243 @@ def test_allow_exact_matches_and_tolerance(
tolerance=Timedelta("100ms"),
allow_exact_matches=False,
)
expected = allow_exact_matches_and_tolerance
df = pd.DataFrame(
Copy link
Member

Choose a reason for hiding this comment

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

Totally separate from this PR but would be nice to have test data that does not span 200 lines of code

@@ -238,20 +229,23 @@ def test_sub(date, offset_box, offset2):


@pytest.mark.parametrize(
"offset_box, offset1",
"offset_box, offset1, dt",
Copy link
Member

Choose a reason for hiding this comment

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

Maybe dt should just be a separate parameter set?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was under the impression that each parameter set needed a particular dt to make the assertions hold below.

Copy link
Member

Choose a reason for hiding this comment

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

Don't want to get hung up on it and maybe misreading, but doesn't the original test always use 01-02-2008 as the dt value? Where did 2014-07-01 come from?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh! My mistake. Previous I thought this used the dt fixture defined above in this file but it looks like it didn't. Looks like I can simplify this parameterization all together.

@mroeschke
Copy link
Member Author

out of curiosity how are you identifying these?

I modified pytest_collection_modifyitems to collect the fixtures associated with each test (unfortunately I don't have the code snippet on hand right now)

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm when green. thanks for doing this @mroeschke - I think helps with the test suite readability and maintenance a lot

@mroeschke mroeschke merged commit 0c23e18 into pandas-dev:main Jan 3, 2024
@mroeschke mroeschke deleted the cln/fixtures3 branch January 3, 2024 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean 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