【pytest】执行测试不输出logging日志问题


【一】

今天更新了一波pytest,4.50 -> 6.2.3。执行了一波测试发现之前的logging输出不见了。

看了下启动参数 --log-cli-level=LOG_CLI_LEVEL

加了一下下,可以了

现在启动参数是

pytest.main(['-v', '-s', os.path.join(BASE_DIR, r'test_case/'), '--alluredir', './report/', '--log-cli-level=INFO'])

 

【二】

如果使用的是pytest-html输出测试报告,show details时,出现No log output captured.情况,可以在启动参数加'--capture=sys'。

pytest.main(
        ['-v', '-s', os.path.join(BASE_DIR, r'test_case/test_notification/test_1.py'), '--html',
         './report/report.html', '--capture=sys', '--log-cli-level=INFO', '--disable-warnings'])

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM