(
func: Callable[..., Any], *, stop: Optional[Callable[[Any], Any]] = None
)
| 573 | real_unwrap = inspect.unwrap |
| 574 | |
| 575 | def _mock_aware_unwrap( |
| 576 | func: Callable[..., Any], *, stop: Optional[Callable[[Any], Any]] = None |
| 577 | ) -> Any: |
| 578 | try: |
| 579 | if stop is None or stop is _is_mocked: |
| 580 | return real_unwrap(func, stop=_is_mocked) |
| 581 | _stop = stop |
| 582 | return real_unwrap(func, stop=lambda obj: _is_mocked(obj) or _stop(func)) |
| 583 | except Exception as e: |
| 584 | warnings.warn( |
| 585 | "Got %r when unwrapping %r. This is usually caused " |
| 586 | "by a violation of Python's object protocol; see e.g. " |
| 587 | "https://github.com/pytest-dev/pytest/issues/5080" % (e, func), |
| 588 | PytestWarning, |
| 589 | ) |
| 590 | raise |
| 591 | |
| 592 | inspect.unwrap = _mock_aware_unwrap |
| 593 | try: |
nothing calls this directly
no test coverage detected
searching dependent graphs…