コード例 #1
0
async def get_server_socket():
    name = Path() / tempfile.gettempdir() / "test.sock"
    try:
        await name.unlink()
    except OSError:
        pass

    serv_sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    serv_sock.bind(fspath(name))  # bpo-32562
    serv_sock.listen(1)

    return name, serv_sock
コード例 #2
0
ファイル: test_path.py プロジェクト: e7dal/trio
async def test_open_file_can_open_path(path):
    async with await trio.open_file(path, 'w') as f:
        assert f.name == fspath(path)
コード例 #3
0
ファイル: _path.py プロジェクト: siver2918/trio
 def __fspath__(self):
     return fspath(self._wrapped)
コード例 #4
0
async def test_open_unix_socket():
    name, serv_sock = await get_server_socket()
    unix_socket = await open_unix_socket(fspath(name))
    await _do_test_on_sock(serv_sock, unix_socket)
コード例 #5
0
ファイル: test_file_io.py プロジェクト: ziirish/trio
def path(tmpdir):
    return fspath(tmpdir.join('test'))
コード例 #6
0
 def __fspath__(self):
     return fspath(self._wrapped)