Beispiel #1
0
def test_kill_custom_signal_kill():
    """Start process and shuts it down using signal SIGQUIT passed to kill."""
    executor = SimpleExecutor(SLEEP_300)
    executor.start()
    assert executor.running() is True
    executor.kill(sig=signal.SIGQUIT)
    assert executor.running() is False
def test_kill_custom_signal_kill():
    """Start process and shuts it down using signal SIGQUIT passed to kill."""
    executor = SimpleExecutor(SLEEP_300)
    executor.start()
    assert executor.running() is True
    executor.kill(sig=signal.SIGQUIT)
    assert executor.running() is False
Beispiel #3
0
def test_custom_signal_kill():
    """Start process and shuts it down using signal SIGQUIT."""
    executor = SimpleExecutor(sleep_300, sig_kill=signal.SIGQUIT)
    executor.start()
    assert executor.running() is True
    executor.kill()
    assert executor.running() is False
def test_daemons_killing():
    """
    Test if all subprocesses of SimpleExecutor can be killed.

    The most problematic subprocesses are daemons or other services that
    change the process group ID. This test verifies that daemon process
    is killed after executor's kill().
    """
    executor = SimpleExecutor(('python', SAMPLE_DAEMON_PATH), shell=True)
    executor.start()
    time.sleep(2)
    assert executor.running() is not True, \
        "Executor should not have subprocess running as it started a daemon."

    assert SAMPLE_DAEMON_PATH in ps_aux()
    executor.kill()
    assert SAMPLE_DAEMON_PATH not in ps_aux()
def test_daemons_killing():
    """
    Test if all subprocesses of SimpleExecutor can be killed.

    The most problematic subprocesses are daemons or other services that
    change the process group ID. This test verifies that daemon process
    is killed after executor's kill().
    """
    executor = SimpleExecutor(('python', SAMPLE_DAEMON_PATH), shell=True)
    executor.start()
    time.sleep(2)
    assert executor.running() is not True, \
        "Executor should not have subprocess running as it started a daemon."

    assert SAMPLE_DAEMON_PATH in ps_aux()
    executor.kill()
    assert SAMPLE_DAEMON_PATH not in ps_aux()