-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: use env variable instead of pytest option for testing ArrayManager #40222
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: use env variable instead of pytest option for testing ArrayManager #40222
Conversation
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.
small comment, looks fine to me
pandas/core/config_init.py
Outdated
@@ -478,14 +479,19 @@ def use_inf_as_na_cb(key): | |||
_use_inf_as_na(key) | |||
|
|||
|
|||
# Get the default from an environment variable, if set, otherwise defaults to "block" |
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 would just inline this on L494 (and add a 1-liner comment before) and/or update the option description with the text on how to control this
should we just change / check for these? |
I think that's a bit fragile to ensure that in the future (and in theory there is also nothing wrong with it, just not working with this option that influences the dataframe creation). Would there be an easy way to check this? |
agree its fragile, but would be good to check it, yeah not sure its easy. |
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
If someone comes up with a good approach for keeping it with the pytest option, we can always change back. But for now I want to ensure I am correctly testing ArrayManager ;) |
I noticed a problem with the current
--array-manager
pytest option to test the ArrayManager, while checking the window tests.The problem with the option is that
conftest.py
files are read first, before handling the option inpytest_sessionstart
. This means that any DataFrame or Series that gets constructed on import of aconftest.py
file, has already been created before the setting is changed, and will thus be created with the wrong manager.Example of this is a DataFrame that is not created inside a (fixture) function, but created top-level in the conftest.py file (or eg used in parametrization).
Luckily we don't have too many of those, but one example in window/conftest.py:
pandas/pandas/tests/window/conftest.py
Lines 352 to 367 in 74a6898
or one example in the toplevel conftest.py:
pandas/pandas/conftest.py
Lines 597 to 608 in 74a6898
So to avoid needing to rewrite those (and continue to ensure such cases don't get added), I don't see another way as using the environment variable approach instead of the pytest option (although the option is much easier to use interactively ..)
cc @jreback