【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