Beispiel #1
0
    def test_lifecycle_none(self):

        process = None

        assert not ProcessMonitor.is_process_alive(process)
        assert not ProcessMonitor.is_supported(process)
        assert not ProcessMonitor._pid(process)
        assert ProcessMonitor.exit_code(process) is None
Beispiel #2
0
    def test_lifecycle_popen(self):

        process = subprocess.Popen(
            ['python', '-c', 'import time; time.sleep(1)'])
        assert ProcessMonitor.is_process_alive(process)
        assert ProcessMonitor._pid(process)
        assert ProcessMonitor.is_supported(process)

        process.communicate()
        assert not ProcessMonitor.is_process_alive(process)
        assert ProcessMonitor.exit_code(process) is not None