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