File: test_is_process_dead.py

package info (click to toggle)
python-briefcase 0.3.25-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,596 kB
  • sloc: python: 62,519; makefile: 60
file content (10 lines) | stat: -rw-r--r-- 389 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
import pytest

from briefcase.integrations.subprocess import is_process_dead


@pytest.mark.parametrize("is_pid_exists, is_dead", [(True, False), (False, True)])
def test_is_process_dead(is_pid_exists, is_dead, monkeypatch):
    """Returns inverse of whether PID exists."""
    monkeypatch.setattr("psutil.pid_exists", lambda pid: is_pid_exists)
    assert is_process_dead(100) is is_dead