コード例 #1
0
 def test_is_alive(self):
     p = Process(target=func_add, args=(42, 89), name="test_is_alive")
     assert p.is_alive() is False
     p.start()
     assert p.is_alive() is True
     p.join()
     assert p.is_alive() is False
コード例 #2
0
 def test_terminate(self):
     p = Process(target=time.sleep, args=(1000,), name="test_terminate")
     p.start()
     assert p.is_alive() is True
     p.terminate()
     time.sleep(0.5)
     assert p.is_alive() is False
     # when terminated, exit code can be 0 for k8s backend
     #assert p.exitcode != 0
     p.join()