-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: run frame/series arithmetic tests with+without numexpr #41178
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: run frame/series arithmetic tests with+without numexpr #41178
Conversation
def switch_numexpr_min_elements(request): | ||
_MIN_ELEMENTS = expr._MIN_ELEMENTS | ||
expr._MIN_ELEMENTS = request.param | ||
yield request.param |
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 copy/pasted this fixture from the tests/arithmetic/
. Is there a way to share such an autouse fixture?
A from pandas.tests.arithmetic.conftest import switch_numexpr_min_elements
would do the trick, but for some reason we disallow explicit imports from conftest.py
files.
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 don't think this needs to be autouse if you are using this explicity (which you are), so just put it in the conftest in tests/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.
It is autoused by all tests in this file, I didn't add it to each test function signature.
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.
Is there a way to share such an autouse fixture?
only thing that comes to mind is defining it as non-autouse in a high-level conftest and then
@pytest.fixture(autouse=True)
def switch_numexpr_min_elements(switch_numexpr_min_elements_non_auotuse):
yield from switch_numexpr_min_elements_non_autouse()
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 am not sure that can work with a fixture as the base function. Because if a fixture is passed as an argument like this, I think it is already what is yielded from that function that is being passed to the new fixture? (it might be possible, but in any case I don't get it to 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.
fair enough; its pretty magical. maybe with yield switch_numexpr_min_elements_non_autouse
instead of yield switch_numexpr_min_elements_non_autouse()
?
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 think I tried that as well (I tried a few variants, and none directly worked), but not fully sure anymore.
def switch_numexpr_min_elements(request): | ||
_MIN_ELEMENTS = expr._MIN_ELEMENTS | ||
expr._MIN_ELEMENTS = request.param | ||
yield request.param |
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 don't think this needs to be autouse if you are using this explicity (which you are), so just put it in the conftest in tests/frame
Failure is the flaky ResourceWarning |
Follow-up on #40463, doing the same for the
test_arithmetic.py
for frame and series.