Exemple #1
0
    def test_kill_process_popen(self):

        process = subprocess.Popen(
            ['python', '-c', 'import time; time.sleep(1)'])
        assert ProcessMonitor.is_process_alive(process)
        ProcessMonitor.kill_process(process)
        assert not ProcessMonitor.is_process_alive(process)
Exemple #2
0
    def test_kill_process_multiprocessing(self):

        process = Process(target=sleep_1sec)
        process.start()

        assert ProcessMonitor.is_process_alive(process)
        ProcessMonitor.kill_process(process)
        assert not ProcessMonitor.is_process_alive(process)

        process = Process(target=sleep_1sec)
        ProcessMonitor.kill_process(process)