Ejemplo n.º 1
0
def test_validate_file_pid_does_not_exist(kill, _open):
    pidfile = gunicorn.pidfile.Pidfile('test.pid')
    kill.side_effect = OSError(errno.ESRCH)
    assert pidfile.validate() is None
Ejemplo n.º 2
0
def test_validate_file_pid_exists_kill_exception(kill, _open):
    pidfile = gunicorn.pidfile.Pidfile('test.pid')
    kill.side_effect = OSError(errno.EPERM)
    assert pidfile.validate() == 1
Ejemplo n.º 3
0
def test_validate_file_pid_exists(kill, _open):
    pidfile = gunicorn.pidfile.Pidfile('test.pid')
    assert pidfile.validate() == 1
    assert kill.called
Ejemplo n.º 4
0
def test_validate_file_pid_malformed(_open):
    pidfile = gunicorn.pidfile.Pidfile('test.pid')
    assert pidfile.validate() is None
Ejemplo n.º 5
0
def test_validate_no_file(_open):
    pidfile = gunicorn.pidfile.Pidfile('test.pid')
    _open.side_effect = IOError(errno.ENOENT)
    assert pidfile.validate() is None