From 35f927dc4bde98acfeb469da386526345d94b671 Mon Sep 17 00:00:00 2001 From: Chris Liechti Date: Mon, 23 May 2016 22:35:06 +0200 Subject: asyncio: use serial_for_url, improve test end --- serial/aio.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/serial/aio.py b/serial/aio.py index 3ba12d2..b3238db 100644 --- a/serial/aio.py +++ b/serial/aio.py @@ -356,7 +356,7 @@ class SerialTransport(asyncio.Transport): @asyncio.coroutine def create_serial_connection(loop, protocol_factory, *args, **kwargs): - ser = serial.Serial(*args, **kwargs) + ser = serial.serial_for_url(*args, **kwargs) protocol = protocol_factory() transport = SerialTransport(loop, protocol, ser) return (transport, protocol) @@ -404,7 +404,8 @@ if __name__ == '__main__': def data_received(self, data): print('data received', repr(data)) - self.transport.close() + if b'\n' in data: + self.transport.close() def connection_lost(self, exc): print('port closed') -- cgit v1.2.1