Skip to content

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

Closed
youtux/pypi-notifier-watchlist
#3
@RonnyPfannschmidt

Description

@RonnyPfannschmidt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions