def test_execute_cmd_in_background():
    """Launch a process in the background then kill it by its pid.
    If the kill was successful, then the process was launched in
    the background correctly."""
    pid = process.execute_cmd_in_background('sleep 101')
    sleep(0.1)
    ret = process.get_return_code_of_simple_cmd("kill {pid}".format(pid=pid))
    assert ret == 0
Beispiel #2
0
def test_execute_cmd_in_background():
    """Launch a process in the background then kill it by its pid.
    If the kill was successful, then the process was launched in
    the background correctly."""
    pid = process.execute_cmd_in_background('sleep 101')
    sleep(0.1)
    ret = process.get_return_code_of_simple_cmd("kill {pid}".format(pid=pid))
    assert ret == 0
def test_get_process_list():
    """Launch a process in the background, get its pid, and list
    the running processes. If the given pid is in the list, then
    we had a good list. At the end kill the process."""
    pid = process.execute_cmd_in_background('sleep 102')
    sleep(0.1)
    found = False
    for p in process.get_process_list():
        if p.pid == pid:
            found = True
            break
            
    assert found
    os.kill(pid, signal.SIGTERM)
Beispiel #4
0
def test_get_process_list():
    """Launch a process in the background, get its pid, and list
    the running processes. If the given pid is in the list, then
    we had a good list. At the end kill the process."""
    pid = process.execute_cmd_in_background('sleep 102')
    sleep(0.1)
    found = False
    for p in process.get_process_list():
        if p.pid == pid:
            found = True
            break

    assert found
    os.kill(pid, signal.SIGTERM)