def test_ps_complete_empty_procs(system_processes): # same as test_ps_complete() but starting with an empty "system_procs" dict pg_processes, __, new_system_procs, fs_blocksize = system_processes def sys_get_proc(pid): return new_system_procs.pop(pid, None) system_procs = {} with patch("pgactivity.activities.sys_get_proc", new=sys_get_proc): procs, io_read, io_write = activities.ps_complete( pg_processes, system_procs, fs_blocksize) assert not new_system_procs # all new system processes consumed assert io_read == IOCounter.default() assert io_write == IOCounter.default() assert len(procs) == len(pg_processes) assert system_procs
def test_ps_complete(system_processes): pg_processes, system_procs, new_system_procs, fs_blocksize = system_processes def sys_get_proc(pid): return new_system_procs.pop(pid, None) n_system_procs = len(system_procs) with patch("pgactivity.activities.sys_get_proc", new=sys_get_proc): procs, io_read, io_write = activities.ps_complete( pg_processes, system_procs, fs_blocksize) assert not new_system_procs # all new system processes consumed assert io_read == IOCounter.default() assert io_write == IOCounter.default() assert len(procs) == len(pg_processes) assert len(system_procs) == n_system_procs assert {p.pid for p in procs} == { 6221, 6222, 6223, 6224, 6225, 6226, 6227, 6228, 6229, 6230, 6231, 6232, 6233, 6234, 6235, 6237, 6238, 6239, 6240, }