aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wqueue2.py
diff options
context:
space:
mode:
authorVG <vg@devys.org>2016-03-14 15:23:01 +0100
committerVG <vg@devys.org>2016-03-14 15:23:01 +0100
commit0eb4d62cf3e1b39540c65acd327925aa3c43947b (patch)
tree78efd6fb9a03c374208ef7d9df17d3d0576d45d1 /tests/wqueue2.py
parentc4d61b7bfa3e3723ff87df8c163c9d77feeff4f8 (diff)
downloadwqueue-0eb4d62cf3e1b39540c65acd327925aa3c43947b.tar.gz
wqueue-0eb4d62cf3e1b39540c65acd327925aa3c43947b.tar.bz2
wqueue-0eb4d62cf3e1b39540c65acd327925aa3c43947b.zip
wip
Diffstat (limited to 'tests/wqueue2.py')
-rwxr-xr-xtests/wqueue2.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/wqueue2.py b/tests/wqueue2.py
new file mode 100755
index 0000000..d53da36
--- /dev/null
+++ b/tests/wqueue2.py
@@ -0,0 +1,46 @@
+#!/usr/bin/python3.5
+
+import asyncio
+import os
+
+async def test():
+ print('sleeping...')
+ await asyncio.sleep(3)
+ print('slept')
+
+
+async def manage_client(reader, writer):
+ print('manage_client created')
+ print('called on connection only ?')
+ await asyncio.sleep(1)
+ print('after sleep1 in server()')
+ while True:
+ line = await reader.readline()
+ if not line:
+ break
+ print('line', line)
+ writer.write(line)
+
+
+def main():
+ print('getting event loop')
+ loop = asyncio.get_event_loop()
+ print('got event loop')
+ # loop.call_soon(test)
+ try:
+ os.unlink('server_sock')
+ print('creating coro...')
+ coro = asyncio.start_unix_server(manage_client, path='server_sock')
+ print('coro created')
+ loop.run_until_complete(coro)
+ print('coro returned')
+ # loop.run_until_complete(test())
+ loop.run_forever()
+ except KeyboardInterrupt:
+ pass
+ print('loop closed')
+ loop.close()
+
+
+if __name__ == '__main__':
+ main()