def test_psalxwww_and_psauxww_and_psaux_parsers(): ps_alxwww = PsAlxwww(context_wrap(PS_ALXWWW_LINES)) ps_auxww = PsAuxww(context_wrap(PS_AUXWW_LINES)) ps_aux = PsAux(context_wrap(PS_AUX_LINES)) ps = Ps(ps_alxwww, ps_auxww, ps_aux, None, None, None, None) len(ps.processes) == 5 ps = ps[1] assert ps['PID'] == 1 assert ps['USER'] == 'root' assert ps['UID'] == 0 assert ps['PPID'] == 0 assert ps['%CPU'] == 0.1 assert ps['%MEM'] == 0.0 assert ps['VSZ'] == 195712.0 assert ps['RSS'] == 7756.0 assert ps['STAT'] == 'Ss' assert ps['TTY'] == '?' assert ps['START'] == '2019' assert ps['TIME'] == '478:05' assert ps[ 'COMMAND'] == '/usr/lib/systemd/systemd --switched-root --system --deserialize 21' assert ps['COMMAND_NAME'] == 'systemd' assert ps['F'] == '4' assert ps['PRI'] == 20 assert ps['NI'] == '0' assert ps['WCHAN'] == 'ep_pol'
def test_psalxwww_and_psauxww_and_psaux_and_psef_and_psauxcww_and_ps_eo_cmd_parsers( ): ps_alxwww = PsAlxwww(context_wrap(PS_ALXWWW_LINES)) ps_auxww = PsAuxww(context_wrap(PS_AUXWW_LINES)) ps_aux = PsAux(context_wrap(PS_AUX_LINES)) ps_ef = PsEf(context_wrap(PS_EF_LINES)) ps_auxcww = PsAuxcww(context_wrap(PS_AUXCWW_LINES)) ps_eo_cmd = PsEoCmd(context_wrap(PS_EO_CMD_LINES, strip=False)) ps_combiner = Ps(ps_alxwww, ps_auxww, ps_aux, ps_ef, ps_auxcww, None, ps_eo_cmd) len(ps_combiner.processes) == 9 ps = ps_combiner[1] assert ps['PID'] == 1 assert ps['USER'] == 'root' assert ps['UID'] == 0 assert ps['PPID'] == 0 assert ps['%CPU'] == 0.1 assert ps['%MEM'] == 0.0 assert ps['VSZ'] == 195712.0 assert ps['RSS'] == 7756.0 assert ps['STAT'] == 'Ss' assert ps['TTY'] == '?' assert ps['START'] == '2019' assert ps['TIME'] == '478:05' assert ps[ 'COMMAND'] == '/usr/lib/systemd/systemd --switched-root --system --deserialize 21' assert ps['COMMAND_NAME'] == 'systemd' assert ps['F'] == '4' assert ps['PRI'] == 20 assert ps['NI'] == '0' assert ps['WCHAN'] == 'ep_pol' assert ps_combiner[13]['COMMAND'] == '/usr/bin/python3.6'
def test_docs(): ps_alxwww = PsAlxwww(context_wrap(PS_ALXWWW_LINES)) ps_auxww = PsAuxww(context_wrap(PS_AUXWW_LINES)) ps_aux = PsAux(context_wrap(PS_AUX_LINES)) ps_ef = PsEf(context_wrap(PS_EF_LINES)) ps_auxcww = PsAuxcww(context_wrap(PS_AUXCWW_LINES)) ps_eo = PsEo(context_wrap(PS_EO_LINES, strip=False)) ps_combiner = Ps(ps_alxwww, ps_auxww, ps_aux, ps_ef, ps_auxcww, ps_eo) env = {'ps_combiner': ps_combiner} failed, total = doctest.testmod(ps, globs=env) assert failed == 0