Skip to content

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

Merged
merged 5 commits into from
Apr 29, 2021

Conversation

jorisvandenbossche
Copy link
Member

Follow-up on #40463, doing the same for the test_arithmetic.py for frame and series.

@jorisvandenbossche jorisvandenbossche added Numeric Operations Arithmetic, Comparison, and Logical operations Testing pandas testing functions or related to the test suite labels Apr 27, 2021
@jorisvandenbossche jorisvandenbossche added this to the 1.3 milestone Apr 27, 2021
def switch_numexpr_min_elements(request):
_MIN_ELEMENTS = expr._MIN_ELEMENTS
expr._MIN_ELEMENTS = request.param
yield request.param
Copy link
Member Author

@jorisvandenbossche jorisvandenbossche Apr 27, 2021

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.

Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Member

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()

Copy link
Member Author

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)

Copy link
Member

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()?

Copy link
Member Author

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
Copy link
Contributor

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

@jorisvandenbossche
Copy link
Member Author

Failure is the flaky ResourceWarning

@jreback jreback merged commit e37bea5 into pandas-dev:master Apr 29, 2021
@jorisvandenbossche jorisvandenbossche deleted the ops-test-numexpr-frame branch April 30, 2021 17:06
yeshsurya pushed a commit to yeshsurya/pandas that referenced this pull request May 6, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Numeric Operations Arithmetic, Comparison, and Logical operations 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