drun 2.3.4__tar.gz → 2.4.2__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 (63) hide show
  1. {drun-2.3.4 → drun-2.4.2}/PKG-INFO +1 -1
  2. {drun-2.3.4 → drun-2.4.2}/drun/__init__.py +1 -1
  3. {drun-2.3.4 → drun-2.4.2}/drun/cli.py +32 -6
  4. drun-2.4.2/drun/utils/config.py +15 -0
  5. {drun-2.3.4 → drun-2.4.2}/drun.egg-info/PKG-INFO +1 -1
  6. {drun-2.3.4 → drun-2.4.2}/drun.egg-info/SOURCES.txt +1 -0
  7. {drun-2.3.4 → drun-2.4.2}/pyproject.toml +1 -1
  8. {drun-2.3.4 → drun-2.4.2}/LICENSE +0 -0
  9. {drun-2.3.4 → drun-2.4.2}/README.md +0 -0
  10. {drun-2.3.4 → drun-2.4.2}/drun/db/__init__.py +0 -0
  11. {drun-2.3.4 → drun-2.4.2}/drun/db/database_proxy.py +0 -0
  12. {drun-2.3.4 → drun-2.4.2}/drun/db/generate_mysql_config.py +0 -0
  13. {drun-2.3.4 → drun-2.4.2}/drun/engine/__init__.py +0 -0
  14. {drun-2.3.4 → drun-2.4.2}/drun/engine/http.py +0 -0
  15. {drun-2.3.4 → drun-2.4.2}/drun/exporters/curl.py +0 -0
  16. {drun-2.3.4 → drun-2.4.2}/drun/importers/base.py +0 -0
  17. {drun-2.3.4 → drun-2.4.2}/drun/importers/curl.py +0 -0
  18. {drun-2.3.4 → drun-2.4.2}/drun/importers/har.py +0 -0
  19. {drun-2.3.4 → drun-2.4.2}/drun/importers/openapi.py +0 -0
  20. {drun-2.3.4 → drun-2.4.2}/drun/importers/postman.py +0 -0
  21. {drun-2.3.4 → drun-2.4.2}/drun/loader/__init__.py +0 -0
  22. {drun-2.3.4 → drun-2.4.2}/drun/loader/collector.py +0 -0
  23. {drun-2.3.4 → drun-2.4.2}/drun/loader/env.py +0 -0
  24. {drun-2.3.4 → drun-2.4.2}/drun/loader/hooks.py +0 -0
  25. {drun-2.3.4 → drun-2.4.2}/drun/loader/yaml_loader.py +0 -0
  26. {drun-2.3.4 → drun-2.4.2}/drun/models/case.py +0 -0
  27. {drun-2.3.4 → drun-2.4.2}/drun/models/config.py +0 -0
  28. {drun-2.3.4 → drun-2.4.2}/drun/models/report.py +0 -0
  29. {drun-2.3.4 → drun-2.4.2}/drun/models/request.py +0 -0
  30. {drun-2.3.4 → drun-2.4.2}/drun/models/step.py +0 -0
  31. {drun-2.3.4 → drun-2.4.2}/drun/models/validators.py +0 -0
  32. {drun-2.3.4 → drun-2.4.2}/drun/notifier/__init__.py +0 -0
  33. {drun-2.3.4 → drun-2.4.2}/drun/notifier/base.py +0 -0
  34. {drun-2.3.4 → drun-2.4.2}/drun/notifier/dingtalk.py +0 -0
  35. {drun-2.3.4 → drun-2.4.2}/drun/notifier/emailer.py +0 -0
  36. {drun-2.3.4 → drun-2.4.2}/drun/notifier/feishu.py +0 -0
  37. {drun-2.3.4 → drun-2.4.2}/drun/notifier/format.py +0 -0
  38. {drun-2.3.4 → drun-2.4.2}/drun/reporter/__init__.py +0 -0
  39. {drun-2.3.4 → drun-2.4.2}/drun/reporter/allure_reporter.py +0 -0
  40. {drun-2.3.4 → drun-2.4.2}/drun/reporter/html_reporter.py +0 -0
  41. {drun-2.3.4 → drun-2.4.2}/drun/reporter/json_reporter.py +0 -0
  42. {drun-2.3.4 → drun-2.4.2}/drun/runner/__init__.py +0 -0
  43. {drun-2.3.4 → drun-2.4.2}/drun/runner/assertions.py +0 -0
  44. {drun-2.3.4 → drun-2.4.2}/drun/runner/extractors.py +0 -0
  45. {drun-2.3.4 → drun-2.4.2}/drun/runner/runner.py +0 -0
  46. {drun-2.3.4 → drun-2.4.2}/drun/scaffolds/__init__.py +0 -0
  47. {drun-2.3.4 → drun-2.4.2}/drun/scaffolds/templates.py +0 -0
  48. {drun-2.3.4 → drun-2.4.2}/drun/templating/__init__.py +0 -0
  49. {drun-2.3.4 → drun-2.4.2}/drun/templating/builtins.py +0 -0
  50. {drun-2.3.4 → drun-2.4.2}/drun/templating/context.py +0 -0
  51. {drun-2.3.4 → drun-2.4.2}/drun/templating/engine.py +0 -0
  52. {drun-2.3.4 → drun-2.4.2}/drun/utils/__init__.py +0 -0
  53. {drun-2.3.4 → drun-2.4.2}/drun/utils/curl.py +0 -0
  54. {drun-2.3.4 → drun-2.4.2}/drun/utils/errors.py +0 -0
  55. {drun-2.3.4 → drun-2.4.2}/drun/utils/logging.py +0 -0
  56. {drun-2.3.4 → drun-2.4.2}/drun/utils/mask.py +0 -0
  57. {drun-2.3.4 → drun-2.4.2}/drun/utils/timeit.py +0 -0
  58. {drun-2.3.4 → drun-2.4.2}/drun.egg-info/dependency_links.txt +0 -0
  59. {drun-2.3.4 → drun-2.4.2}/drun.egg-info/entry_points.txt +0 -0
  60. {drun-2.3.4 → drun-2.4.2}/drun.egg-info/requires.txt +0 -0
  61. {drun-2.3.4 → drun-2.4.2}/drun.egg-info/top_level.txt +0 -0
  62. {drun-2.3.4 → drun-2.4.2}/setup.cfg +0 -0
  63. {drun-2.3.4 → drun-2.4.2}/tests/test_templating.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drun
3
- Version: 2.3.4
3
+ Version: 2.4.2
4
4
  Summary: Minimal HTTP API test runner (MVP)
5
5
  Author: Drun Team
6
6
  Requires-Python: >=3.10
@@ -1,2 +1,2 @@
1
1
  __all__ = ["__version__"]
2
- __version__ = "2.3.3"
2
+ __version__ = "2.4.2"
@@ -1,13 +1,16 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import json
4
- import sys
5
4
  import os
5
+ import re
6
+ import sys
7
+ import time
8
+ import unicodedata
9
+ from importlib import metadata as _im
6
10
  from pathlib import Path
7
11
  from typing import Any, Dict, List, Optional, Tuple
8
12
 
9
13
  import typer
10
- from importlib import metadata as _im
11
14
  import yaml
12
15
 
13
16
  from drun.loader.collector import discover, match_tags
@@ -23,11 +26,31 @@ from drun.models.report import RunReport
23
26
  from drun.reporter.json_reporter import write_json
24
27
  from drun.runner.runner import Runner
25
28
  from drun.templating.engine import TemplateEngine
29
+ from drun.utils.config import get_system_name
30
+ from drun.utils.errors import LoadError
26
31
  from drun.utils.logging import setup_logging, get_logger
27
- import time
28
32
 
29
33
 
30
- from drun.utils.errors import LoadError
34
+ def _sanitize_filename_component(value: str, fallback: str) -> str:
35
+ value = (value or "").strip()
36
+ if not value:
37
+ return fallback
38
+ normalized = unicodedata.normalize("NFKC", value)
39
+ invalid_chars = {'<', '>', ':', '"', '/', '\\', '|', '?', '*'}
40
+ cleaned_chars = []
41
+ for ch in normalized.lower():
42
+ if ord(ch) < 32:
43
+ cleaned_chars.append("-")
44
+ continue
45
+ if ch in invalid_chars:
46
+ cleaned_chars.append("-")
47
+ continue
48
+ cleaned_chars.append(ch)
49
+ candidate = "".join(cleaned_chars)
50
+ candidate = re.sub(r"\s+", "-", candidate)
51
+ candidate = re.sub(r"-{2,}", "-", candidate)
52
+ candidate = candidate.strip(" .-")
53
+ return candidate or fallback
31
54
 
32
55
 
33
56
  def _resolve_env_file_alias(value: str) -> tuple[str, bool, List[str]]:
@@ -1072,7 +1095,9 @@ def run(
1072
1095
  """运行测试用例或测试套件"""
1073
1096
  # default log file path
1074
1097
  ts = time.strftime("%Y%m%d-%H%M%S")
1075
- default_log = log_file or f"logs/run-{ts}.log"
1098
+ system_name = get_system_name()
1099
+ log_component = _sanitize_filename_component(system_name, "run")
1100
+ default_log = log_file or f"logs/{log_component}-{ts}.log"
1076
1101
  setup_logging(log_level, log_file=default_log)
1077
1102
  log = get_logger("drun.cli")
1078
1103
  # unify httpx logs: default suppress, unless enabled
@@ -1264,7 +1289,8 @@ def run(
1264
1289
  s.get("steps_skipped", 0),
1265
1290
  )
1266
1291
 
1267
- html_target = html or f"reports/report-{ts}.html"
1292
+ html_component = _sanitize_filename_component(system_name, "report")
1293
+ html_target = html or f"reports/{html_component}-{ts}.html"
1268
1294
 
1269
1295
  if report:
1270
1296
  write_json(report_obj, report)
@@ -0,0 +1,15 @@
1
+ """
2
+ 配置工具模块
3
+ 提供统一的配置访问接口
4
+ """
5
+ import os
6
+
7
+
8
+ def get_system_name():
9
+ """
10
+ 获取系统名称,优先级:SYSTEM_NAME > PROJECT_NAME > "Drun"
11
+
12
+ Returns:
13
+ str: 系统名称
14
+ """
15
+ return os.environ.get("SYSTEM_NAME") or os.environ.get("PROJECT_NAME", "Drun")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drun
3
- Version: 2.3.4
3
+ Version: 2.4.2
4
4
  Summary: Minimal HTTP API test runner (MVP)
5
5
  Author: Drun Team
6
6
  Requires-Python: >=3.10
@@ -52,6 +52,7 @@ drun/templating/builtins.py
52
52
  drun/templating/context.py
53
53
  drun/templating/engine.py
54
54
  drun/utils/__init__.py
55
+ drun/utils/config.py
55
56
  drun/utils/curl.py
56
57
  drun/utils/errors.py
57
58
  drun/utils/logging.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "drun"
7
- version = "2.3.4"
7
+ version = "2.4.2"
8
8
  description = "Minimal HTTP API test runner (MVP)"
9
9
  requires-python = ">=3.10"
10
10
  authors = [{ name = "Drun Team" }]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes