smartpush 1.0.2.9__py3-none-any.whl → 1.0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,13 @@
1
1
  import os
2
+ import re
2
3
  from io import BytesIO
3
4
  import pandas as pd
4
5
  import numpy as np
6
+ import warnings
5
7
  from requests import request
8
+ """
9
+ 用于excel校验
10
+ """
6
11
 
7
12
 
8
13
  def read_excel_from_oss(method="get", url=""):
@@ -26,7 +31,9 @@ def read_excel_and_write_to_dict(excel_data=None, file_name=None):
26
31
  pass
27
32
  elif file_name is not None:
28
33
  excel_data = os.path.join(os.path.dirname(os.getcwd()) + "/check_file/" + file_name)
29
- df = pd.read_excel(excel_data, engine="openpyxl")
34
+ with warnings.catch_warnings():
35
+ warnings.filterwarnings("ignore", category=UserWarning, module=re.escape('openpyxl.styles.stylesheet'))
36
+ df = pd.read_excel(excel_data, engine="openpyxl")
30
37
  # 将DataFrame转换为字典,以行为单位存储数据
31
38
  row_dict = {} # 创建一个空字典来存储按行转换的数据
32
39
  for index, row in df.iterrows(): # 遍历DataFrame中的每一行
@@ -46,12 +53,15 @@ def read_excel_and_write_to_list(excel_data=None, file_name=None):
46
53
  pass
47
54
  elif file_name is not None:
48
55
  excel_data = os.path.join(os.path.dirname(os.getcwd()) + "/check_file/" + file_name)
49
- df = pd.read_excel(excel_data, engine="openpyxl")
56
+
57
+ with warnings.catch_warnings():
58
+ warnings.filterwarnings("ignore", category=UserWarning, module=re.escape('openpyxl.styles.stylesheet'))
59
+ df = pd.read_excel(excel_data, engine="openpyxl")
50
60
  # 将DataFrame转换为字典,以行为单位存储数据
51
61
  rows_list = df.values.tolist()
52
62
  return rows_list
53
63
  except Exception as e:
54
- print(f"excel写入dict时出错:{e}")
64
+ print(f"excel写入list时出错:{e}")
55
65
 
56
66
 
57
67
  def read_excel_and_write_to_csv(excel_data, file_name):
@@ -72,7 +82,7 @@ def check_excel(actual, expected):
72
82
  """
73
83
  try:
74
84
  if actual == expected:
75
- return True
85
+ return True, ["完全匹配"]
76
86
  else:
77
87
  errors = []
78
88
  # 断言1:校验行数
@@ -80,7 +90,7 @@ def check_excel(actual, expected):
80
90
  expected_num = len(expected)
81
91
  check_row = actual_num - expected_num
82
92
  if check_row == 0:
83
- pass
93
+ errors.append("预期和实际行数相等,为" + str(actual_num) + "行")
84
94
  else:
85
95
  errors.append(
86
96
  "行数和预期对比差" + check_row.__str__() + "行" + ", 实际:" + str(actual_num) + "预期: " + str(
@@ -99,6 +109,7 @@ def check_excel(actual, expected):
99
109
  return False, errors
100
110
  except Exception as e:
101
111
  print(f"对比excel:{e}")
112
+ return False, [e]
102
113
 
103
114
 
104
115
  def del_temp_file(file_name=""):
smartpush/felix_test.py CHANGED
@@ -1,8 +1,11 @@
1
+ import requests
2
+
1
3
  from smartpush.export.basic import ExcelExportChecker
2
4
 
3
5
  if __name__ == '__main__':
4
6
 
5
7
  ossurl = "https://sl-smartfile.oss-ap-southeast-1.aliyuncs.com/material_ec2/2025-01-16/8556e34c8d4d45f0bb2d42dc8871a90b/%E8%A1%A8%E5%8D%95%E4%BB%BB%E5%8A%A1%E6%95%B0%E6%8D%AE%E6%A6%82%E8%A7%88.xlsx"
6
8
  excelOss = ExcelExportChecker.read_excel_from_oss(url=ossurl)
7
- excelList = ExcelExportChecker.read_excel_and_write_to_list(excel_data=excelOss)
9
+ excelList = ExcelExportChecker.read_excel_and_write_to_dict(excel_data=excelOss)
8
10
  print(excelList)
11
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smartpush
3
- Version: 1.0.2.9
3
+ Version: 1.0.3.1
4
4
  Summary: 用于smartpush自动化测试工具包
5
5
  Author: 卢泽彬、邵宇飞、周彦龙
6
6
 
@@ -0,0 +1,10 @@
1
+ smartpush/__init__.py,sha256=XJrl1vhGATHSeSVqKmPXxYqxyseriUpvY5tLIXir3EE,24
2
+ smartpush/felix_test.py,sha256=5ke2JOal9FWC5GK4Qpdzlt7Tdlab1vb4LJyBLTd3hYk,476
3
+ smartpush/get_jira_info.py,sha256=dmCwkKa94xwyE2hegE1KBI3cV_LbrJ67P9osORUGPt4,2633
4
+ smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
5
+ smartpush/export/basic/ExcelExportChecker.py,sha256=N_vQL2AWX2CfakfH6QJLhkx3EcRiqFmAdX7F5HJRlMk,4794
6
+ smartpush/export/basic/__init__.py,sha256=6tcrS-2NSlsJo-UwEsnGUmwCf7jgOsh_UEbM0FD-gYE,70
7
+ smartpush-1.0.3.1.dist-info/METADATA,sha256=cuwVFc6-wYLsmDg9y3KQRb86JuwJ89nfdFSrzAXpg30,147
8
+ smartpush-1.0.3.1.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
9
+ smartpush-1.0.3.1.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
10
+ smartpush-1.0.3.1.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- smartpush/__init__.py,sha256=XJrl1vhGATHSeSVqKmPXxYqxyseriUpvY5tLIXir3EE,24
2
- smartpush/felix_test.py,sha256=AaLMo_SWsm_NQLj-SbcPcoSpcf-wluCLWdr3hm0_BCI,458
3
- smartpush/get_jira_info.py,sha256=dmCwkKa94xwyE2hegE1KBI3cV_LbrJ67P9osORUGPt4,2633
4
- smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
5
- smartpush/export/basic/ExcelExportChecker.py,sha256=t1_28uY0LB1rUgOfIlyXUtH5y8id85zkLvGCmAIPQCE,4305
6
- smartpush/export/basic/__init__.py,sha256=6tcrS-2NSlsJo-UwEsnGUmwCf7jgOsh_UEbM0FD-gYE,70
7
- smartpush-1.0.2.9.dist-info/METADATA,sha256=AqcfMMuqlv0vOAmIXAI1GfC0DFrzaxkLeruueb9c62s,147
8
- smartpush-1.0.2.9.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
9
- smartpush-1.0.2.9.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
10
- smartpush-1.0.2.9.dist-info/RECORD,,