gpt4 book ai didi

python - Pytest:捕获的 stderr 设置和捕获的日志设置重复

转载 作者:行者123 更新时间:2023-12-04 16:46:07 31 4
gpt4 key购买 nike

enter image description here
如上面的屏幕截图所示:创建驱动程序实例时,我的 pytest-html 报告为我提供了“Captured stdout setup”和“Captured log setup”。有没有办法将其关闭以使其不多余?

 -----------------------------Captured stdout setup------------------------------ 


-----------------------------Captured stderr setup------------------------------
[WDM] - Current google-chrome version is 87.0.4280
[WDM] - Get LATEST driver version for 87.0.4280
[WDM] - Driver [C:\Users\olga\.wdm\drivers\chromedriver\win32\87.0.4280.88\chromedriver.exe] found in cache

-------------------------------Captured log setup-------------------------------
INFO WDM:logger.py:24 Current google-chrome version is 87.0.4280
INFO WDM:logger.py:14 Get LATEST driver version for 87.0.4280
INFO WDM:logger.py:14 Driver [C:\Users\olga\.wdm\drivers\chromedriver\win32\87.0.4280.88\chromedriver.exe] found in cache

最佳答案

一种解决方法,但解决了我的问题:
我将创建驱动程序实例并使用 fixture 移至单独的文件 Base Test - 我的测试类继承它而不是使用 @pytest.usefixtures 装饰器

import pytest
@pytest.mark.usefixtures("driver_setup")
class BaseTest:
pass

关于python - Pytest:捕获的 stderr 设置和捕获的日志设置重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65322296/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com