-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
TST: Improve runtime of some unit tests #62968
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
Changes from 12 commits
d7cf8b9
0a23c73
231e00c
cb29a48
3845800
b9da54f
0461452
3a331eb
35152b1
fcb2c70
2f9a4b8
bbfc543
9946794
be90fce
ce39137
cdd56e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,9 @@ | |
| date, | ||
| datetime, | ||
| ) | ||
| import gc | ||
| import itertools | ||
| import re | ||
| import string | ||
| import weakref | ||
|
|
||
| import numpy as np | ||
| import pytest | ||
|
|
@@ -2164,15 +2162,14 @@ def test_memory_leak(self, kind): | |
| index=date_range("2000-01-01", periods=10, freq="B"), | ||
| ) | ||
|
|
||
| # Use a weakref so we can see if the object gets collected without | ||
| # also preventing it from being collected | ||
| ref = weakref.ref(df.plot(kind=kind, **args)) | ||
|
|
||
| # have matplotlib delete all the figures | ||
| plt.close("all") | ||
| # force a garbage collection | ||
| gc.collect() | ||
| assert ref() is None | ||
| ax = df.plot(kind=kind, **args) | ||
| if kind in ["line", "area"]: | ||
| for i, (cached_data, _, _) in enumerate(ax._plot_data): | ||
| ser = df.iloc[:, i] | ||
| assert not tm.shares_memory(ser, cached_data) | ||
| tm.assert_numpy_array_equal(ser._values, cached_data._values) | ||
| else: | ||
| assert not hasattr(ax, "_plot_data") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this new test looks fine, but it isn't obvious to me that it is testing the same thing as the old one.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair point. I added a comment pointing to the Github issue describing where the original reference cycle was. |
||
|
|
||
| def test_df_gridspec_patterns_vert_horiz(self): | ||
| # GH 10819 | ||
|
|
||
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.
the comment above makes me think in this case size was made bigger. now you're making it smaller. am i interpreting the comment wrong?
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.
Fair point, the comment becomes outdated with this change. I'll update it.
For reference, I'm using the same technique used in the test above,
test_chunks_have_consistent_numerical_type, to patchDEFAULT_BUFFER_HEURISTICso we don't have to run a test with so much data to hit a condition.