async def go(): scheduler = AsyncIOScheduler(loop) starttime = loop.time() endtime = None def action(scheduler, state): nonlocal endtime endtime = loop.time() scheduler.schedule_relative(0.2, action) await asyncio.sleep(0.3) assert endtime is not None diff = endtime - starttime assert diff > 0.18
async def go(): ran = False scheduler = AsyncIOScheduler(loop) def action(scheduler, state): nonlocal ran ran = True d = scheduler.schedule_relative(0.05, action) d.dispose() await asyncio.sleep(0.3) assert ran is False