|
@@ -189,7 +189,7 @@ class TestMain(unittest.TestCase):
|
|
|
|
|
|
|
|
|
@patch("time.sleep")
|
|
|
- @patch("os.killpg")
|
|
|
+ @patch("os.kill")
|
|
|
@patch("os._exit")
|
|
|
@patch("os.path.exists")
|
|
|
def test_daemonize_and_stop(self, exists_mock, _exit_mock, kill_mock, sleep_mock):
|
|
@@ -207,7 +207,7 @@ class TestMain(unittest.TestCase):
|
|
|
# Testing normal exit
|
|
|
exists_mock.return_value = False
|
|
|
main.stop_agent()
|
|
|
- kill_mock.assert_called_with(os.getpgid(int(pid)), signal.SIGTERM)
|
|
|
+ kill_mock.assert_called_with(int(pid), signal.SIGTERM)
|
|
|
_exit_mock.assert_called_with(0)
|
|
|
|
|
|
# Restore
|
|
@@ -217,8 +217,8 @@ class TestMain(unittest.TestCase):
|
|
|
# Testing exit when failed to remove pid file
|
|
|
exists_mock.return_value = True
|
|
|
main.stop_agent()
|
|
|
- kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGTERM)
|
|
|
- kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGKILL)
|
|
|
+ kill_mock.assert_any_call(int(pid), signal.SIGTERM)
|
|
|
+ kill_mock.assert_any_call(int(pid), signal.SIGKILL)
|
|
|
_exit_mock.assert_called_with(1)
|
|
|
|
|
|
# Restore
|