Test process existence checking.
()
| 115 | |
| 116 | |
| 117 | def test_process_exists(): |
| 118 | """Test process existence checking.""" |
| 119 | print("Testing process existence checking...") |
| 120 | |
| 121 | # Current process should exist |
| 122 | current_pid = os.getpid() |
| 123 | assert process_exists(current_pid), "Current process not detected as alive" |
| 124 | |
| 125 | # PID 1 should exist on Unix systems (init/systemd) |
| 126 | # On Windows, we'll skip this check |
| 127 | if os.name != "nt": |
| 128 | assert process_exists(1), "PID 1 not detected as alive" |
| 129 | |
| 130 | # Very high PID should not exist |
| 131 | assert not process_exists(999999), "Non-existent PID incorrectly detected as alive" |
| 132 | |
| 133 | print("✓ Process existence test passed") |
| 134 | |
| 135 | |
| 136 | def main(): |
no test coverage detected