MCPcopy Index your code
hub / github.com/RustPython/RustPython / main

Method main

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

Source from the content-addressed store, hash-verified

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

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