-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: parametrize test_info #37887
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: parametrize test_info #37887
Conversation
pandas/tests/io/formats/test_info.py
Outdated
@@ -82,18 +78,41 @@ def test_info_categorical_column(): | |||
df2.info(buf=buf) | |||
|
|||
|
|||
def test_info(float_frame, datetime_frame): | |||
def test_info_frame_float_frame_just_works(float_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.
"just_works" -> "smoke_test" maybe?
the existing test is a pattern i really dislike, where we have two unrelated fixtures for what should be separate tests (that you've separated, which i like). but it would be nice to find a way to parametrize over float_frame/datetime_frame. i think indirect
might be related, but never fully got the hang of that
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.
I managed to do so using the approach described here: https://stackoverflow.com/a/64246323
For that, however, I needed to explicitly import float_frame
. Without the import it would not work.
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.
Now pre-commit check complains about the non-standard imports because I explicitly import fixture functions.
Please suggest
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.
Fixed that as @jreback suggested #37887 (comment)
pandas/tests/io/formats/test_info.py
Outdated
), | ||
], | ||
) | ||
def test_info_memory_usage_qualified(frame, plus): |
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.
separating these i like, but im trying to push back against parametrization that creates DataFrame etc objects at test collection time. it increases the memory footprint which is breaking the windows builds.
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.
Right, I remember your suggestion to reduce footprint.
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.
Reverted back.
pandas/tests/io/formats/test_info.py
Outdated
io = StringIO() | ||
float_frame.info(buf=io) | ||
datetime_frame.info(buf=io) | ||
frame.info(buf=io) |
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.
can you do result = io.getvalue()
and assert somthing about the result (not the whole thing)
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.
e.g. assert len(result.splitlines()) > 100 or something
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.
Done.
Can anyone suggest on dealing with pre-commit check? |
I think we need to abandon the idea of using the indirect fixture parametrization |
So I should go ahead and split |
bottom line i dont think this is worth futzing over all that much. if you really want, you could try something like
|
It's greenish. |
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.
LGTM
thanks @ivanovmg |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Precursor for #37320