多线程测试用例run时出错:

multiprocessing.pool.MaybeEncodingError: Error sending result: ’<appium.webdriver.webdriver.WebDriver (session=“261019ae-3776-4a78-aa2c-b24bb64ec62e”)>’. Reason: ’AttributeError(“Can’t pickle local object ‘PoolManager.__init__.<locals>.<lambda>‘“)’

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

 

 

1.用线程替换进程
2.可以使用copy_reg来规避上面的异常.
3.dill 或pathos.multiprocesssing :use 'import pathos.multiprocesssing', instead of 'import multiprocessing'. pathos.multiprocessing is a fork of multiprocessing that uses dill. dill can serialize almost anything in python, so you are able to send a lot more around in parallel.

 

 

参考来源:

https://blog.csdn.net/dutsoft/article/details/70336462

https://blog.csdn.net/izzzyx/article/details/54601624

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄