Skip to content
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

Fix recursion in pytest.approx() with arrays in numpy<1.13 #3761

Merged
merged 2 commits into from
Aug 2, 2018

Conversation

nicoddemus
Copy link
Member

Fix #3748

cc @ironiccode @tigarmo

I tested this patch manually using this example from @tigarmo using numpy 1.11:

def testApprox():
    from pytest import approx
    import numpy as np

    a = np.array([1, 2, 3])
    assert a == approx([1, 2, 3])

I did not add tests for this because it requires numpy<1.13. I thought it overkill to add another CI environment because of this.

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blanked approval to support the merge,
the related parties are capable and i'm happy to see this merged once verified

@coveralls
Copy link

coveralls commented Aug 1, 2018

Coverage Status

Coverage increased (+0.05%) to 92.547% when pulling b825530 on nicoddemus:numpy-recursion-error into 4588130 on pytest-dev:master.

So we remember what happened and don't accidentally regress in the
future.
@kalekundert
Copy link
Contributor

This was a pretty weird bug, so I thought it would be prudent to put a comment in the code indicating why the comparison has to be done in a certain way.

@nicoddemus nicoddemus merged commit 5db2e6c into pytest-dev:master Aug 2, 2018
@nicoddemus nicoddemus deleted the numpy-recursion-error branch August 2, 2018 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants