Exemple #1
0
 def test_child_in_processes(self):
     """list_processes() should contain new process's PID"""
     running_pids_pre = [p.pid for p in pidmon.list_processes()]
     p1 = _utils.DummyProcess()
     try:
         p1.start()
         while p1.process.pid is None:        # make sure it's started
             pass
         assert (p1.process.pid not in running_pids_pre)
         running_pids = [p.pid for p in pidmon.list_processes()]
         assert (p1.process.pid in running_pids), "{} not in {!r}".format(p1.process.pid, running_pids)
     finally:
         p1.stop()
     running_pids_post = [p.pid for p in pidmon.list_processes()]
     assert (p1.process.pid not in running_pids_post)
Exemple #2
0
 def _unused_pid():
     running_pids = [p.pid for p in pidmon.list_processes()]
     i = 1
     while i in running_pids:
         i += 1
     return i
Exemple #3
0
 def test_self_in_processes(self):
     """list_processes() should contain current python process's PID"""
     running_pids = [p.pid for p in pidmon.list_processes()]
     assert (os.getpid() in running_pids)