MCPcopy Index your code
hub / github.com/python/cpython / main

Method main

Lib/test/test_asyncio/test_unix_events.py:1271–1286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1269 time.sleep(1)
1270
1271 async def main():
1272 loop = asyncio.get_running_loop()
1273 loop.add_signal_handler(signal.SIGTERM, lambda *args: parent_handled.set())
1274
1275 process = ctx.Process(target=child_main)
1276 process.start()
1277 child_started.wait()
1278 os.kill(process.pid, signal.SIGTERM)
1279 process.join(timeout=support.SHORT_TIMEOUT)
1280
1281 async def func():
1282 await asyncio.sleep(0.1)
1283 return 42
1284
1285 # Test parent's loop is still functional
1286 self.assertEqual(await asyncio.create_task(func()), 42)
1287
1288 asyncio.run(main())
1289

Callers 1

Calls 10

funcFunction · 0.70
add_signal_handlerMethod · 0.45
setMethod · 0.45
ProcessMethod · 0.45
startMethod · 0.45
waitMethod · 0.45
killMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45
create_taskMethod · 0.45

Tested by

no test coverage detected