MCPcopy Create free account
hub / github.com/apify/crawlee-python / test_snapshot_cpu

Function test_snapshot_cpu

tests/unit/_autoscaling/test_snapshotter.py:92–99  ·  view source on GitHub ↗
(
    snapshotter: Snapshotter, event_system_data_info: EventSystemInfoData, event_manager: LocalEventManager
)

Source from the content-addressed store, hash-verified

90
91
92async def test_snapshot_cpu(
93 snapshotter: Snapshotter, event_system_data_info: EventSystemInfoData, event_manager: LocalEventManager
94) -> None:
95 event_manager.emit(event=Event.SYSTEM_INFO, event_data=event_system_data_info)
96 await event_manager.wait_for_all_listeners_to_complete()
97 cpu_snapshots = cast('list[CpuSnapshot]', snapshotter.get_cpu_sample())
98 assert len(cpu_snapshots) == 1
99 assert cpu_snapshots[0].used_ratio == event_system_data_info.cpu_info.used_ratio
100
101
102async def test_snapshot_memory(

Callers

nothing calls this directly

Calls 3

get_cpu_sampleMethod · 0.80
emitMethod · 0.45

Tested by

no test coverage detected