Poll target callable for a truthy return value. Like `_poll_for`, but raises a `TimeoutError` if the target does not return a truthy value within the timeout. Args: target: callable that returns truthy if polling condition is met. timeout: max pollin
(
target: Callable[[], T],
timeout: TimeoutType = None,
step: TimeoutType = None,
)
| 747 | |
| 748 | @staticmethod |
| 749 | def poll_for_or_raise_timeout( |
| 750 | target: Callable[[], T], |
| 751 | timeout: TimeoutType = None, |
| 752 | step: TimeoutType = None, |
| 753 | ) -> T: |
| 754 | """Poll target callable for a truthy return value. |
| 755 | |
| 756 | Like `_poll_for`, but raises a `TimeoutError` if the target does not |
| 757 | return a truthy value within the timeout. |
| 758 | |
| 759 | Args: |
| 760 | target: callable that returns truthy if polling condition is met. |
| 761 | timeout: max polling time |
| 762 | step: interval between checking target() |
| 763 | |
| 764 | Returns: |
| 765 | return value of target() if truthy within timeout |
| 766 | |
| 767 | Raises: |
| 768 | TimeoutError: when target does not return a truthy value within timeout |
| 769 | """ |
| 770 | result = AppHarness._poll_for( |
| 771 | target=target, |
| 772 | timeout=timeout, |
| 773 | step=step, |
| 774 | ) |
| 775 | if result is False: |
| 776 | msg = "Target did not return a truthy value while polling." |
| 777 | raise TimeoutError(msg) |
| 778 | return result |
| 779 | |
| 780 | @staticmethod |
| 781 | def expect( |
no test coverage detected