使用Pytest-xdist庫執行分布式跑用例報錯:No module named '_pytest.resultlog' 的解決方案


前言

  1.使用庫:pytest 6.1.0

  2.使用庫:pytest-xdist 2.2.0

 

運行分布式的測試代碼:

 1 import pytest,time
 2 
 3 def test_01():
 4     time.sleep(3)
 5     print('-------test01---------')
 6 
 7 def test_02():
 8     time.sleep(3)
 9     print('-------test02---------')
10 
11 if __name__ == '__main__':
12     pytest.main(['test_xt.py','-sq','-n','6'])

 

問題:執行上面測試代碼均會報以下錯誤:

 

解決版本:降pytest與pytest-xdist版本(我降至pytest 5.4.0 與pytest-xdist 1.3.3版本)

運行成功

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM