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

_pytest.compat.get_real_func is unaware of getattr-ish objects like mock.call #2208

Closed
RonnyPfannschmidt opened this issue Jan 19, 2017 · 1 comment

Comments

@RonnyPfannschmidt
Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt commented Jan 19, 2017

this would break on things like the mock.call object, there should be an iteration limit

i propose using something like

for _ in range(1000):
  new_func = getattr(func, '__wrapped__', None)
  if new_func is None:
    break
  else:
    func = new_func
else:
  raise ValueError("unwrap failed to find a end")

all tho i presume we can pick a much lower iteration count

RonnyPfannschmidt added a commit to RonnyPfannschmidt/pytest that referenced this issue Jan 19, 2017
nicoddemus added a commit that referenced this issue Jan 19, 2017
…func_loop_limit

fixes #2208 by introducing a iteration limit
@nicoddemus
Copy link
Member

@nicoddemus nicoddemus commented Jan 19, 2017

Fixed by #2209

@nicoddemus nicoddemus closed this Jan 19, 2017
This was referenced Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.