From 1c875209f7ea1a48d0361fec51f9a0f20358e60d Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 12 Feb 2023 10:47:58 +0000 Subject: [PATCH] python: create test accounts in parallel --- .../src/deltachat_rpc_client/pytestplugin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py b/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py index 36969c9c1..87e97f0e0 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py @@ -2,6 +2,7 @@ import json import os from typing import AsyncGenerator, List, Optional +import asyncio import aiohttp import pytest_asyncio @@ -51,11 +52,13 @@ class ACFactory: await bot.configure(credentials["email"], credentials["password"]) return bot + async def get_online_account(self) -> Account: + account = await self.new_configured_account() + await account.start_io() + return account + async def get_online_accounts(self, num: int) -> List[Account]: - accounts = [await self.new_configured_account() for _ in range(num)] - for account in accounts: - await account.start_io() - return accounts + return await asyncio.gather(*[self.get_online_account() for _ in range(num)]) async def send_message( self,