MCPcopy Create free account
hub / github.com/livekit/agents / format_task

Function format_task

tests/conftest.py:304–321  ·  view source on GitHub ↗
(task)

Source from the content-addressed store, hash-verified

302
303
304def format_task(task) -> str:
305 try:
306 name = task.get_name() if hasattr(task, "get_name") else "<unknown name>"
307 coro = task.get_coro()
308 coro_name = getattr(coro, "__qualname__", None) or type(coro).__name__
309 frame = getattr(coro, "cr_frame", None)
310 if frame:
311 location = f"{frame.f_code.co_filename}:{frame.f_lineno}"
312 else:
313 location = "no frame available"
314 return (
315 f"Task Name : {name}\n"
316 f"Coroutine : {coro_name}\n"
317 f"Location : {location}\n"
318 f"State : {'pending' if not task.done() else 'done'}"
319 )
320 except Exception:
321 return repr(task)
322
323
324@pytest.fixture(autouse=True)

Callers 1

fail_on_leaked_tasksFunction · 0.85

Calls 1

doneMethod · 0.45

Tested by

no test coverage detected