Python pytest 资深大佬进,求助,

€¶婷姐儿♛
€¶婷姐儿♛
订阅者
262
文章
0
粉丝
测试交流评论174字数 112阅读0分22秒阅读模式

问题:

同时使用 pytest.mark.parametrize 和 pytest.mark.asyncio 时,async 的效果会失效。文章源自玩技e族-https://www.playezu.com/180534.html

截图:文章源自玩技e族-https://www.playezu.com/180534.html

Python
 pytest 资深大佬进,求助,插图
文章源自玩技e族-https://www.playezu.com/180534.html

预期:文章源自玩技e族-https://www.playezu.com/180534.html

预期应该小幅度于 6 秒,但是程序是以串行的方式跑,总耗时 2*3==6 秒左右文章源自玩技e族-https://www.playezu.com/180534.html

stack overflow 的相关问题:文章源自玩技e族-https://www.playezu.com/180534.html

https://stackoverflow.com/questions/61821196/why-does-using-pytest-asyncio-and-parametrize-cause-tests-to-run-for-longer-tha文章源自玩技e族-https://www.playezu.com/180534.html

有人遇到一样的问题,暂时没有比较优雅的解决方案,说是 Run the tests in parallel with the pytest-xdist plugin,但是这受限于 cpu 核心,不是我想要的文章源自玩技e族-https://www.playezu.com/180534.html文章源自玩技e族-https://www.playezu.com/180534.html

 
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证