def pytest_configure(config):
global LOOP_INIT
loop_name = config.getoption('--loop')
factory = {
"aioloop": asyncio.new_event_loop,
}
if uvloop is not None:
factory["uvloop"] = uvloop.new_event_loop
if loop_name:
if loop_name not in factory:
raise ValueError(
"{name} is not valid option".format(name=loop_name)
)
LOOP_INIT = factory[loop_name]
else:
LOOP_INIT = factory["aioloop"]
评论列表
文章目录