删除读取excel数据时的冗余代码

This commit is contained in:
zy7y 2020-08-12 18:54:11 +08:00
parent cc5c048f42
commit 0ae897c066
1 changed files with 2 additions and 17 deletions

View File

@ -22,28 +22,13 @@ class ReadData(object):
:return: data_list - pytest参数化可用的数据
"""
data_list = []
table = self.book.sheet_by_index(0)
for norw in range(1, table.nrows):
# 每行第4列 是否运行
if table.cell_value(norw, 3) == '':
continue
# 返回该行的所有单元格组成的数据 table.row_values(0) 0代表第1列
case_number = table.cell_value(norw, 0)
case_title = table.cell_value(norw, 1)
path = table.cell_value(norw, 2)
is_token = table.cell_value(norw, 4)
method = table.cell_value(norw, 5)
# 入参关键字
parametric_key = table.cell_value(norw, 6)
file_var = table.cell_value(norw, 7)
file_path = table.cell_value(norw, 8)
# 路径参数
parameters = table.cell_value(norw, 9)
dependent = table.cell_value(norw, 10)
data = table.cell_value(norw, 11)
expect = table.cell_value(norw, 12)
value = [case_number, case_title, path, is_token, method, parametric_key, file_var, file_path, parameters, dependent, data, expect]
value = table.row_values(norw)
value.pop(3)
# 配合将每一行转换成元组存储,迎合 pytest的参数化操作如不需要可以注释掉 value = tuple(value)
value = tuple(value)
logger.info(f'{value}')