问题:
同时使用 pytest.mark.parametrize 和 pytest.mark.asyncio 时,async 的效果会失效。
截图:
预期:
预期应该小幅度于 6 秒,但是程序是以串行的方式跑,总耗时 2*3==6 秒左右
stack overflow 的相关问题:
https://stackoverflow.com/questions/61821196/why-does-using-pytest-asyncio-and-parametrize-cause-tests-to-run-for-longer-tha
有人遇到一样的问题,暂时没有比较优雅的解决方案,说是 Run the tests in parallel with the pytest-xdist plugin,但是这受限于 cpu 核心,不是我想要的
大佬,解决了吗,最近也遇到了这个问题,parametrize 默认是串行的,不能并发,内部虽然是异步的,但是没有意义