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

Projects
None yet
2 participants
@RonnyPfannschmidt
Member

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

Merge pull request #2209 from RonnyPfannschmidt/bugfix-2208/get_real_…
…func_loop_limit

fixes #2208 by introducing a iteration limit
@nicoddemus

This comment has been minimized.

Member

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