Skip to content

Commit

Permalink
tests/signals: Silence resource warnings in subprocesses
Browse files Browse the repository at this point in the history
  • Loading branch information
1st1 committed Apr 19, 2016
1 parent 97a6450 commit e720208
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions tests/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ async def worker():
loop = """ + self.NEW_LOOP + """
asyncio.set_event_loop(loop)
loop.create_task(worker())
loop.run_forever()
try:
loop.run_forever()
finally:
srv.close()
loop.run_until_complete(srv.wait_closed())
loop.close()
"""

proc = await asyncio.create_subprocess_exec(
Expand Down Expand Up @@ -141,7 +146,12 @@ def handler_hup(say):
loop.add_signal_handler(signal.SIGHUP, handler_hup, '!s-hup!')
asyncio.set_event_loop(loop)
loop.create_task(worker())
loop.run_forever()
try:
loop.run_forever()
finally:
srv.close()
loop.run_until_complete(srv.wait_closed())
loop.close()
"""

proc = await asyncio.create_subprocess_exec(
Expand Down Expand Up @@ -193,7 +203,13 @@ def handler_hup():
loop.add_signal_handler(signal.SIGUSR2, handler2)
loop.add_signal_handler(signal.SIGHUP, handler_hup)
loop.create_task(worker())
loop.run_forever()
try:
loop.run_forever()
finally:
srv.close()
loop.run_until_complete(srv.wait_closed())
loop.close()
"""

proc = await asyncio.create_subprocess_exec(
Expand Down Expand Up @@ -261,7 +277,12 @@ def aio_handler():
loop.add_signal_handler(signal.SIGUSR1, aio_handler)
asyncio.set_event_loop(loop)
loop.create_task(worker())
loop.run_forever()
try:
loop.run_forever()
finally:
srv.close()
loop.run_until_complete(srv.wait_closed())
loop.close()
print('step3', flush=True)
print(input(), flush=True)
"""
Expand Down

0 comments on commit e720208

Please sign in to comment.