예제 #1
0
def test_timeout_error(ctx, state):
    with pytest.raises(TimeoutError):
        zproc.ping(ctx.server_address, timeout=0)

    with pytest.raises(TimeoutError):
        ctx.ping(timeout=0)

    with pytest.raises(TimeoutError):
        state.ping(timeout=0)
예제 #2
0
def test_ping_after_close(ctx, state):
    ctx.server_process.terminate()

    with pytest.raises(TimeoutError):
        zproc.ping(ctx.server_address, timeout=0.1)

    with pytest.raises(TimeoutError):
        ctx.ping(timeout=0.1)

    with pytest.raises(TimeoutError):
        state.ping(timeout=0.1)
예제 #3
0
def test_ping_after_close():
    ctx.close()

    with pytest.raises(TimeoutError):
        zproc.ping(ctx.server_address, timeout=1)

    with pytest.raises(TimeoutError):
        ctx.ping(timeout=1)

    with pytest.raises(TimeoutError):
        ctx.state.ping(timeout=1)
예제 #4
0
def test_timeout(ctx, state):
    pid = ctx.server_process.pid
    assert zproc.ping(ctx.server_address, timeout=0.1) == pid
    assert state.ping(timeout=0.1) == pid
    assert ctx.ping(timeout=0.1) == pid
예제 #5
0
def test_ping(ctx, state):
    pid = ctx.server_process.pid
    assert zproc.ping(ctx.server_address) == pid
    assert state.ping() == pid
    assert ctx.ping() == pid
예제 #6
0
def test_timeout():
    assert zproc.ping(ctx.server_address, timeout=1) == pid
    assert ctx.state.ping(timeout=1) == pid
    assert ctx.ping(timeout=1) == pid
예제 #7
0
def test_ping():
    assert zproc.ping(ctx.server_address) == pid
    assert ctx.state.ping() == pid
    assert ctx.ping() == pid