smartpush 1.3.2__tar.gz → 1.3.5__tar.gz

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,5 +1,5 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smartpush
3
- Version: 1.3.2
3
+ Version: 1.3.5
4
4
  Summary: 用于smartpush自动化测试工具包
5
5
  Author: 卢泽彬、邵宇飞、周彦龙
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='smartpush',
5
- version='1.3.2',
5
+ version='1.3.5',
6
6
  description='用于smartpush自动化测试工具包',
7
7
  author='卢泽彬、邵宇飞、周彦龙',
8
8
  packages=find_packages(),
@@ -2,14 +2,23 @@ import datetime
2
2
  import json
3
3
  import requests
4
4
  from jira import JIRA
5
-
6
5
  from smartpush.utils.StringUtils import StringUtils
7
6
 
8
7
  test_user = {
9
8
  "邵宇飞": "dw_shaoyufei",
10
9
  "卢泽彬-Lulu-QA": "dw_luzebin",
11
10
  "xiangchen zhong": "dw_zhongxiangchen",
12
- "周彦龙": "zhouyanlong"
11
+ "周彦龙": "dw_zhouyanlong",
12
+ "梁铭津-bryant": "dw_liangmingjin",
13
+ "高忠明 - gaozhongming": "dw_gaozhongming",
14
+ "jiayong zhang": "dw_zhangjiayong",
15
+ "毕杰芳-Dawn Bi": "dw_bijiefang",
16
+ "李志": "dw_lizhi7",
17
+ "张玉吉-小橙C": "dw_zhangyuji",
18
+ "周艳辉-zhouyanhui-QA": "dw_zhouyanhui",
19
+ "zhaoyi wang": "dw_wangzhaoyi",
20
+ "测试-陈美伶-Zoe": "dw_chenmeiling",
21
+ "黄伟灵": "dw_huangweiling"
13
22
  }
14
23
 
15
24
 
@@ -61,27 +70,27 @@ def get_update_issues_jql():
61
70
 
62
71
 
63
72
  class JiraInfo:
64
- def __init__(self, _jira_user, _api_key, _project_key):
73
+ def __init__(self, _jira_user, _api_key):
65
74
  self.project_name = None
66
75
  self.jira_url = "https://shopline.atlassian.net/"
67
- self.project_key = _project_key
76
+ # self.project_key = _project_key
68
77
  self.issue = None
69
78
  self.jira_user = _jira_user
70
79
  self.jira_api_key = _api_key
71
80
  self.jira = JIRA(server=self.jira_url, basic_auth=(self.jira_user, self.jira_api_key))
72
- self.get_jira_prodcut()
81
+ # self.get_jira_prodcut()
73
82
  self.custom_fields = self.get_custom_fields()
74
83
 
75
- def get_jira_prodcut(self):
76
- """"""
77
- project = self.jira.project(str(self.project_key))
78
- self.project_name = project.name
79
- print(f"Project: {project.key} - {project.name}")
84
+ # def get_jira_prodcut(self):
85
+ # """"""
86
+ # project = self.jira.project(str(self.project_key))
87
+ # self.project_name = project.name
88
+ # print(f"Project: {project.key} - {project.name}")
80
89
  # return project
81
90
 
82
91
  def get_custom_fields(self) -> dict:
83
92
  """
84
- 查询指定项目jira中的自定义字段,smartpush项目是 10559
93
+ 查询指定项目jira中的自定义字段,smartpush项目是 10559 商品是 10092
85
94
  @param project_id: 项目id
86
95
  @param jira_obj: 对象
87
96
  @return: 返回的是自定义的值对应的id
@@ -92,10 +101,7 @@ class JiraInfo:
92
101
  for field in all_fields:
93
102
  try:
94
103
  if field.get('custom'):
95
- # if field['scope']['project']['id'] == self.project_key:
96
104
  custom_fields[field['id']] = field['name']
97
- # else:
98
- # pass
99
105
  except:
100
106
  continue
101
107
  # print(custom_fields)
@@ -112,7 +118,7 @@ class JiraInfo:
112
118
  filter_obj = self.jira.filter(filter_id)
113
119
  jql = filter_obj.jql
114
120
  elif jql is None:
115
- default_jql_str = f'project = {self.project_key}'
121
+ default_jql_str = f'project = SSP'
116
122
  try:
117
123
  all_issues = {}
118
124
  start_at = 0
@@ -194,6 +200,7 @@ class JiraInfo:
194
200
  else:
195
201
  print(f"{new_jql} 更新失败!")
196
202
  except Exception as e:
203
+ # raise e
197
204
  print(f"更新过滤器 JQL 时出错: {e}")
198
205
 
199
206
  def product_and_ui_acceptance_notice(self, webhook, datas):
@@ -233,7 +240,33 @@ class JiraInfo:
233
240
  tester_user_id = self.get_tester_wecom_userid(value.get("测试人员"), test_user)
234
241
  test_end_time = value.get("测试完成时间(测试环境)")
235
242
  content += f"> [{key + '-' + summary}]({url}) \n测试:{tester_user_id} \n测试完成时间:{test_end_time}\n\n "
236
- content = f"### <font color=\"warning\"> 本周涉及后端需求如下,请分析并登记覆盖率,周会前填写</font> \n" + content
243
+ content = f"### <font color=\"warning\"> 本周涉及后端需求如下,请分析并登记覆盖率报告,周会前填写</font> \n" + content
244
+ self.send_wecom_robot_message(webhook, content)
245
+
246
+ def registration_coverage_notice_every_day(self, webhook, datas):
247
+ """
248
+ 1、有后端开发工作量时才提示
249
+ 2、并且把填写的链接附上
250
+ :return:
251
+ """
252
+ content = ""
253
+ today = datetime.date.today().strftime('%Y-%m-%d')
254
+ for key, value in datas.items():
255
+ adjusted_test_completion_time = value.get("调整后测试完成时间(测试环境)")
256
+ test_end_time = value.get("测试完成时间(测试环境)") if adjusted_test_completion_time is None else adjusted_test_completion_time
257
+ test_end_text = '测试完成时间(测试环境)' if adjusted_test_completion_time is None else '调整后测试完成时间(测试环境)'
258
+ test_end_time_new = datetime.datetime.strptime(test_end_time, "%Y-%m-%d").strftime('%Y-%m-%d') if test_end_time is not None else None
259
+ summary = value.get("summary")
260
+ url = value.get("url")
261
+ backend_workload = value.get("后端工作量")
262
+ if test_end_time is not None and backend_workload is not None and backend_workload > 0 and test_end_time_new == today:
263
+ tester_user_id = self.get_tester_wecom_userid(value.get("测试人员"), test_user)
264
+ content += f"> [{key + '-' + summary}]({url}) \n后端工作量:{backend_workload}\n测试人员:{tester_user_id} \n{test_end_text}:{test_end_time}\n\n "
265
+ if StringUtils.is_empty(content):
266
+ print(f"*** {today} 无涉及覆盖率登记需求,不发送通知 ***")
267
+ return
268
+ content = f"### <font color=\"warning\"> 涉及后端需求,测试完成后,请分析并登记覆盖率报告</font> \n" + content
269
+ # print(content)
237
270
  self.send_wecom_robot_message(webhook, content)
238
271
 
239
272
  def bug_not_closed_notice(self, webhook, datas):
@@ -252,6 +285,7 @@ class JiraInfo:
252
285
  tester_user_id = self.get_tester_wecom_userid(value.get("测试人员"), test_user)
253
286
  content += f"> [{key + '-' + summary}]({url}) \n暂未修复bug数量:{len(not_fixed_dict)}\n测试:{tester_user_id} \n\n "
254
287
  if StringUtils.is_empty(content):
288
+ print("无待修复bug..不发送通知")
255
289
  return
256
290
  content = f"### <font color=\"warning\"> 提醒本周上线需求暂未修复缺陷,请尽快确认</font> \n" + content
257
291
  self.send_wecom_robot_message(webhook, content)
@@ -290,6 +324,8 @@ class JiraInfo:
290
324
  :return:
291
325
  """
292
326
  mobile_string = ""
327
+ if tester is None:
328
+ return None
293
329
  for name in tester:
294
330
  user_id = user_data.get(name, None)
295
331
  mobile_string += f"<@{user_id}>"
@@ -370,17 +406,11 @@ class JiraInfo:
370
406
  try:
371
407
  response = requests.post(webhook_url, headers=headers, data=json.dumps(data))
372
408
  response.raise_for_status()
409
+ print("发送企微消息成功!")
373
410
  return response.json()
374
411
  except requests.RequestException as e:
375
412
  print(f"请求出错: {e}")
376
413
  return None
377
414
  except ValueError as e:
378
415
  print(f"解析响应出错: {e}")
379
- return None
380
-
381
-
382
- # if __name__ == '__main__':
383
- # # jirainfo.product_and_ui_acceptance_notice(webhook_url, result) # 发验收
384
- # # jirainfo.bug_not_closed_notice(webhook_url, result) # bug未修复
385
- # # jirainfo.registration_coverage_notice(webhook_url, result) # 覆盖率
386
- # # jirainfo.modify_the_online_status_of_jira_notice(webhook_url, result) # 覆盖率
416
+ return None
File without changes
@@ -1,5 +1,5 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smartpush
3
- Version: 1.3.2
3
+ Version: 1.3.5
4
4
  Summary: 用于smartpush自动化测试工具包
5
5
  Author: 卢泽彬、邵宇飞、周彦龙
@@ -2,6 +2,7 @@ README.md
2
2
  setup.py
3
3
  smartpush/__init__.py
4
4
  smartpush/get_jira_info.py
5
+ smartpush/test.py
5
6
  smartpush.egg-info/PKG-INFO
6
7
  smartpush.egg-info/SOURCES.txt
7
8
  smartpush.egg-info/dependency_links.txt
File without changes
File without changes