MCPcopy Create free account
hub / github.com/dateutil/dateutil / _list_with_timeout

Function _list_with_timeout

tests/test_rrule.py:5097–5108  ·  view source on GitHub ↗
(iterable, timeout=5)

Source from the content-addressed store, hash-verified

5095
5096
5097def _list_with_timeout(iterable, timeout=5):
5098 # If the cache lock is never released, iterating blocks forever instead
5099 # of raising. Iterate in a background thread so the test fails after
5100 # ``timeout`` seconds instead of hanging the suite.
5101 result = []
5102 thread = threading.Thread(
5103 target=result.extend, args=(iterable,), daemon=True
5104 )
5105 thread.start()
5106 thread.join(timeout)
5107 assert not thread.is_alive(), "Iteration did not finish"
5108 return result
5109
5110
5111def test_cached_rrule_iterators_started_before_cache_complete():

Calls

no outgoing calls

Tested by

no test coverage detected