pytest-api-framework-alpha 0.3.11__tar.gz → 0.3.13__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.
Files changed (32) hide show
  1. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/PKG-INFO +1 -1
  2. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/conftest.py +5 -5
  3. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/db/mysql_db.py +11 -5
  4. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/pytest_api_framework_alpha.egg-info/PKG-INFO +1 -1
  5. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/setup.py +1 -1
  6. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/__init__.py +0 -0
  7. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/base_class.py +0 -0
  8. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/db/__init__.py +0 -0
  9. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/db/redis_db.py +0 -0
  10. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/exceptions.py +0 -0
  11. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/exit_code.py +0 -0
  12. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/extract.py +0 -0
  13. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/global_attribute.py +0 -0
  14. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/http_client.py +0 -0
  15. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/render_data.py +0 -0
  16. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/report.py +0 -0
  17. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/script.py +0 -0
  18. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/startapp.py +0 -0
  19. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/utils/__init__.py +0 -0
  20. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/utils/common.py +0 -0
  21. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/utils/date_util.py +0 -0
  22. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/utils/encrypt.py +0 -0
  23. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/utils/lark_util.py +0 -0
  24. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/utils/log_util.py +0 -0
  25. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/utils/mock_util.py +0 -0
  26. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/utils/yaml_util.py +0 -0
  27. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/framework/validate.py +0 -0
  28. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/pytest_api_framework_alpha.egg-info/SOURCES.txt +0 -0
  29. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/pytest_api_framework_alpha.egg-info/dependency_links.txt +0 -0
  30. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/pytest_api_framework_alpha.egg-info/requires.txt +0 -0
  31. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/pytest_api_framework_alpha.egg-info/top_level.txt +0 -0
  32. {pytest_api_framework_alpha-0.3.11 → pytest_api_framework_alpha-0.3.13}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-api-framework-alpha
3
- Version: 0.3.11
3
+ Version: 0.3.13
4
4
  Author: alpha
5
5
  Author-email:
6
6
  Requires-Python: >=3.6
@@ -279,9 +279,10 @@ def pytest_generate_tests(metafunc):
279
279
 
280
280
 
281
281
  def pytest_collection_modifyitems(items):
282
+ # 过滤掉不在收集范围的case
283
+ items = [item for item in items if getattr(item, "callspec", None)]
282
284
  # 重新排序
283
285
  new_items = sort(items)
284
- # Demo: new_items = [items[0],items[2],items[1],items[3]]
285
286
  items[:] = new_items
286
287
  for item in items:
287
288
  # 获取mark标记
@@ -292,6 +293,8 @@ def pytest_collection_modifyitems(items):
292
293
  item.add_marker(mark)
293
294
 
294
295
 
296
+
297
+
295
298
  def pytest_collection_finish(session):
296
299
  """获取最终排序后的 items 列表"""
297
300
  logger.info(f"共收集到 {len(session.items)} 个测试用例")
@@ -526,7 +529,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config):
526
529
  if settings.ONLY_LINUX_NOTIFICATION:
527
530
  if "linux" not in platform.platform().lower():
528
531
  return
529
- for webhook in settings.LARK_WEBHOOKS:
532
+ for webhook in settings.LARK_WEBHOOKS.get(CONTEXT.get("env")):
530
533
  LarkUtil(webhook).send_test_report(
531
534
  total=total,
532
535
  passed=passed,
@@ -537,7 +540,6 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config):
537
540
  env=CONTEXT.get("env")
538
541
  )
539
542
 
540
-
541
543
  def pytest_exception_interact(node, call, report):
542
544
  """
543
545
  用例执行抛出异常时,将异常记录到日志
@@ -801,11 +803,9 @@ def sort(case_items):
801
803
  # 生成每个组当前的索引
802
804
  ori_name_temp = None
803
805
  ori_name_list = []
804
-
805
806
  for item in non_custom_scope_items:
806
807
  clase_id = item.cls.__name__
807
808
  original_name = item.originalname
808
-
809
809
  if ori_name_temp is None or ori_name_temp == original_name:
810
810
  ori_name_temp = original_name
811
811
  case_suite_num += 1
@@ -139,8 +139,14 @@ class MysqlDB:
139
139
 
140
140
  @staticmethod
141
141
  def custom_serializer(obj):
142
- if isinstance(obj, datetime):
143
- return obj.strftime('%Y-%m-%d %H:%M:%S') # 转换时间格式
144
- elif isinstance(obj, Decimal):
145
- return float(obj) # 转换 Decimal 为 float
146
- raise TypeError(f"Type {type(obj)} not serializable")
142
+ try:
143
+ if isinstance(obj, datetime):
144
+ return obj.strftime('%Y-%m-%d %H:%M:%S')
145
+ elif isinstance(obj, Decimal):
146
+ return float(obj)
147
+ elif isinstance(obj, bytes):
148
+ return obj.decode(errors='ignore', encoding='utf-8')
149
+ # 不处理的类型:直接返回原对象
150
+ return obj
151
+ except Exception:
152
+ return obj
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-api-framework-alpha
3
- Version: 0.3.11
3
+ Version: 0.3.13
4
4
  Author: alpha
5
5
  Author-email:
6
6
  Requires-Python: >=3.6
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pytest-api-framework-alpha", # 包名(必须唯一)
5
- version="0.3.11",
5
+ version="0.3.13",
6
6
  packages=find_packages(),
7
7
  author="alpha",
8
8
  author_email="",