MCPcopy
hub / github.com/reflex-dev/reflex / poll_for_or_raise_timeout

Method poll_for_or_raise_timeout

reflex/testing.py:749–778  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

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(

Callers 15

poll_for_tokenFunction · 0.80
test_login_flowFunction · 0.80
tokenFunction · 0.80
driverFunction · 0.80
test_tailwind_appFunction · 0.80
tokenFunction · 0.80
tokenFunction · 0.80
tokenFunction · 0.80
test_media_appFunction · 0.80
raises_alertFunction · 0.80
tokenFunction · 0.80
driverFunction · 0.80

Calls 1

_poll_forMethod · 0.80

Tested by

no test coverage detected