def test__pids_holding_file_failed(self): # type: () -> None (self.mock_callable(pidutil, "run_with_timeout").to_return_value( CompletedProcess(returncode=1, stderr="oh no")).and_assert_called_once) self.assertFalse( pidutil._pids_holding_file("/path/to/lsof", "/tmp/foo"))
def test__pids_holding_file_success(self): # type: () -> None (self.mock_callable(pidutil, "run_with_timeout").to_return_value( CompletedProcess(stdout="\n".join( ["p12345", "f1", "p123456", "f1"]))).and_assert_called_once) self.assertEqual(set([12345, 123456]), pidutil._pids_holding_file("/path/to/lsof", "/tmp/a"))
def test__pids_holding_file_timeout(self): # type: () -> None (self.mock_callable(pidutil, "run_with_timeout").to_raise( DcRPMException()).and_assert_called_once) self.assertFalse( pidutil._pids_holding_file("/path/to/lsof", "/tmp/foo"))