Skip to content
This repository was archived by the owner on Mar 1, 2019. It is now read-only.
This repository was archived by the owner on Mar 1, 2019. It is now read-only.

使用多设备执行脚本的时候,html report功能无法正常使用 #120

@mexth

Description

@mexth

两台手机,同时执行脚本,不使用html report功能可以正常完成脚本,一旦使用该功能执行就会出问题
脚本结构如下:

# coding: utf-8
import atx,time,sys,os,traceback,multiprocessing
from atx.ext.report import Report

def RunTest(serials):
    from multiprocessing.dummy import Pool as ThreadPool
    pool = ThreadPool()
    pool.map(SingleTest, serials)
    pool.close()
    pool.join()

def SingleTest(serialno):
    d = atx.connect(serialno)
    rp = Report(d, save_dir=serialno)
    rp.patch_uiautomator()
    rp.info("Test started", screenshot=d.screenshot())
    d.start_app( "com.mxtech.videoplayer.pro","com.mxtech.videoplayer.pro.ActivityMediaList")
#    rp.assert_ui_exists(d(description='更多选项'), desc='Hello UI')
    d(description="更多选项").click()
    ...主体脚本...
    rp.close()
if __name__ == '__main__':
    RunTest(["5406a354","CB5A21SX9A"])

出错的log:

>>> 
========================== RESTART: D:\python\11.py ==========================
2017-04-13 08:34:00.474 WARN  [atx.drivers.mixin: 390] warning, screenshot failed [2/1], retry again
2017-04-13 08:34:16.530 WARN  [atx.drivers.mixin: 390] warning, screenshot failed [2/1], retry again

Traceback (most recent call last):
  File "D:\python\11.py", line 55, in <module>
    RunTest(["5406a354","CB5A21SX9A"])
  File "D:\python\11.py", line 9, in RunTest
    pool.map(SingleTest, serials)
  File "C:\Python27\lib\multiprocessing\pool.py", line 251, in map
    return self.map_async(func, iterable, chunksize).get()
  File "C:\Python27\lib\multiprocessing\pool.py", line 567, in get
    raise self._value
IOError: unrecognized data stream contents when reading image file
2017-04-13 08:34:17.151 WARN  [atx.drivers.mixin: 390] warning, screenshot failed [2/1], retry again
>>> Next
Back to view list
list test end 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions