zoukankan      html  css  js  c++  java
  • 使用python判断Android自动化的渠道包是否全部打完

    Android客户端测试上线总会有很多的渠道包,渠道的打包可以使用自动化,但是每次打完都是好几十个或者几百个apk,很难确定是不是所有的渠道都已经打完,所以就有了下面的一段代码,主要就是为了检查是否将所有的渠道包打包完毕:

     1 # coding=utf-8
     2 import os
     3 import xlrd
     4 import shutil
     5 #获取给定excel列表中的所有渠道号
     6 def add_Qudao_Name(channel_excel_path):
     7     data=xlrd.open_workbook(channel_excel_path)
     8     table=data.sheets()[0]
     9     nrows=table.nrows
    10     a=[]
    11     for i in xrange(1,nrows):
    12         channel=table.cell_value(i,1).encode('utf-8').strip()
    13         a.append(channel)
    14     return a
    15 #获取给定excel列表中的每个渠道号和source的对应
    16 def add_Qudao_Source(channel_excel_path):
    17     data=xlrd.open_workbook(channel_excel_path)
    18     table=data.sheets()[0]
    19     nrows=table.nrows
    20     a={}
    21     for i in xrange(1,nrows):
    22         channel=table.cell_value(i,1).encode('utf-8').strip()
    23         source=int(table.cell_value(i,2))
    24         a[channel]=source
    25     return a
    26 #从指定打包的apk文件名中截取到渠道号
    27 def find_Package_Name(start_str,end_str,name):
    28     start=name.find(start_str)
    29     if start>=0:
    30         end=name.find(end_str)-1
    31         if end>=0:
    32             return name[start:end]
    33 #筛选已有的渠道号是否全部打包完成
    34 def check_Package_Name(dir):#dir为渠道包所在路径
    35      channels=add_Qudao_Name()
    36      a=[]
    37      for i in os.listdir(dir):
    38         s=find_Package_Name('A','r',i)
    39         if s!=None:
    40             a.append(s)
    41      b=[]
    42      for m in channels:
    43          if m not in(a):
    44             b.append(m)
    45 
    46      return b
    47 #将指定列表中的渠道包从打出的所有渠道包中拷贝出来
    48 def copy_Package_list(dir):#dir为渠道包路径
    49     channels=add_Qudao_Name()
    50     for m in channels:
    51         for i in os.listdir(dir):
    52             s=find_Package_Name('A','r',i)
    53             if s!=".DS_Store" and s==m:
    54                 shutil.copy(dir+i,r'/Users/tangyao/Desktop/test')
  • 相关阅读:
    ISAPI实现静态页面后并用c#实现分页
    aspx里构造函数里无法使用session,需要重写一个方法放在load里面就能正常使用session了
    记录学习MVC过程,MVC异步请求(五)
    记录学习MVC过程,MVC验证(四)
    记录学习MVC过程,MVC简单路由(三)
    【读书笔记】【韭菜的自我修养】
    【中间件】redis的学习
    【java基础】线程池
    【算法】leetcode刷题 腾讯精选50题 一
    【碎语】让你废掉的七个行为
  • 原文地址:https://www.cnblogs.com/guoke1001/p/4153895.html
Copyright © 2011-2022 走看看