Exemplo n.º 1
0
def test_socket_cleanup_after_exception():
    try:
        with volatile.unix_socket() as (_, addr):
            name = addr
            assert os.path.exists(name)
            raise RuntimeError()
            pass
    except RuntimeError:
        pass

    assert not os.path.exists(name)
Exemplo n.º 2
0
def test_socket():
    with volatile.unix_socket() as (sock, addr):
        assert hasattr(sock, 'close')
        assert os.path.exists(addr)

    assert not os.path.exists(addr)