【一】
今天更新了一波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'])