Esempio n. 1
0
    def test_no_such_process(self):
        """ No processes """
        def raises(*a,**kw):
            e = OSError("!")
            e.errno = 3
            raise e

        with patch.object(os, 'kill') as Pkill:
            Pkill.side_effect = raises
            self.assertEqual(False, daemon._pid_exists(555))
            Pkill.assert_called_once_with(555, 0)
Esempio n. 2
0
    def test_no_such_process(self):
        """ No processes """
        def raises(*a, **kw):
            e = OSError("!")
            e.errno = 3
            raise e

        with patch.object(os, 'kill') as Pkill:
            Pkill.side_effect = raises
            self.assertEqual(False, daemon._pid_exists(555))
            Pkill.assert_called_once_with(555, 0)
Esempio n. 3
0
    def test_perms_error(self):
        """ If we don't have perms the process exists """
        def raises(*a,**kw):
            e = OSError("!")
            e.errno = 1
            raise e

        with patch.object(os, 'kill') as Pkill:
            Pkill.side_effect = raises
            self.assertEqual(True, daemon._pid_exists(555))
            Pkill.assert_called_once_with(555, 0)
Esempio n. 4
0
    def test_perms_error(self):
        """ If we don't have perms the process exists """
        def raises(*a, **kw):
            e = OSError("!")
            e.errno = 1
            raise e

        with patch.object(os, 'kill') as Pkill:
            Pkill.side_effect = raises
            self.assertEqual(True, daemon._pid_exists(555))
            Pkill.assert_called_once_with(555, 0)
Esempio n. 5
0
 def test_kill_returns_none(self):
     """ This means the process is running """
     with patch.object(os, 'kill') as Pkill:
         Pkill.return_value = None
         self.assertEqual(True, daemon._pid_exists(555))
         Pkill.assert_called_once_with(555, 0)
Esempio n. 6
0
 def test_lessthan0(self):
     """ Should be False"""
     self.assertEqual(False, daemon._pid_exists(-88))
Esempio n. 7
0
 def test_kill_returns_none(self):
     """ This means the process is running """
     with patch.object(os, 'kill') as Pkill:
         Pkill.return_value = None
         self.assertEqual(True, daemon._pid_exists(555))
         Pkill.assert_called_once_with(555, 0)
Esempio n. 8
0
 def test_lessthan0(self):
     """ Should be False"""
     self.assertEqual(False, daemon._pid_exists(-88))