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

TST: Parameterize & make tests more performant #55830

Merged
merged 14 commits into from
Nov 7, 2023

Conversation

mroeschke
Copy link
Member

No description provided.

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Nov 4, 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.

nice changes. do you know how much time this saves?

pandas/tests/frame/methods/test_align.py Outdated Show resolved Hide resolved
result = pd.read_pickle(handle)
handle.seek(0) # shouldn't close file handle
compare_element(result, expected, typ)
@pytest.mark.parametrize("typ, expected", flatten(create_pickle_data()))
Copy link
Member

Choose a reason for hiding this comment

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

how big is the memory footprint of create_pickle_data? i think doing this outside the test means it sticks around during the whole collection/runtime

Copy link
Member Author

@mroeschke mroeschke Nov 6, 2023

Choose a reason for hiding this comment

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

Doing a recursive getsizeof of the dict yields 426965 bytes so it doesn't seem too much. Additionally IIUC before this data was being yielded from the current_pickle_data fixture which caches & keeps the data around after first use

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

@mroeschke
Copy link
Member Author

do you know how much time this saves?

Locally in total for this PR probably a second or so. Another benefit for the tests that reduce the data size is to also to reduce the peak memory pressure of a test.

@mroeschke mroeschke added this to the 2.2 milestone Nov 7, 2023
@mroeschke mroeschke merged commit 8c52003 into pandas-dev:main Nov 7, 2023
28 of 34 checks passed
@mroeschke mroeschke deleted the tst/perf branch November 7, 2023 01:17
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