api-engine-xin 0.0.29__tar.gz → 0.0.30__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. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/engine/script_runner.py +14 -3
  2. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/PKG-INFO +1 -1
  3. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/api_engine_xin.egg-info/PKG-INFO +1 -1
  4. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/setup.py +1 -1
  5. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/__init__.py +0 -0
  6. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/core.py +0 -0
  7. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/engine/__init__.py +0 -0
  8. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/engine/assertion.py +0 -0
  9. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/engine/base_case.py +0 -0
  10. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/engine/exceptions.py +0 -0
  11. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/engine/extractor.py +0 -0
  12. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/engine/precondition.py +0 -0
  13. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/engine/replacer.py +0 -0
  14. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/http/__init__.py +0 -0
  15. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/http/client.py +0 -0
  16. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/http/files.py +0 -0
  17. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/infra/__init__.py +0 -0
  18. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/infra/case_log.py +0 -0
  19. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/infra/db_client.py +0 -0
  20. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/infra/global_func.py +0 -0
  21. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/infra/suite_store.py +0 -0
  22. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/ApiEngine/infra/test_result.py +0 -0
  23. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/LICENSE +0 -0
  24. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/README.md +0 -0
  25. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/api_engine_xin.egg-info/SOURCES.txt +0 -0
  26. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/api_engine_xin.egg-info/dependency_links.txt +0 -0
  27. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/api_engine_xin.egg-info/requires.txt +0 -0
  28. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/api_engine_xin.egg-info/top_level.txt +0 -0
  29. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/setup.cfg +0 -0
  30. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/tests/Tools.py +0 -0
  31. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/tests/__init__.py +0 -0
  32. {api_engine_xin-0.0.29 → api_engine_xin-0.0.30}/tests/runTest.py +0 -0
@@ -19,16 +19,27 @@ class ScriptRunner:
19
19
  print = test_instance.print_log
20
20
  test_instance.env = {}
21
21
 
22
+ # 显式 globals 命名空间,确保 import 语句和嵌套作用域(生成器表达式/lambda)正常工作
23
+ _namespace = {
24
+ "__builtins__": __builtins__,
25
+ "test": test,
26
+ "ENV": ENV,
27
+ "global_var": global_var,
28
+ "print": print,
29
+ "global_func": global_func,
30
+ "db": db,
31
+ }
32
+
22
33
  # 执行前置脚本
23
34
  setup_scripts = data.get("setup_script")
24
35
  if setup_scripts and isinstance(setup_scripts, str):
25
- exec(setup_scripts)
36
+ exec(setup_scripts, _namespace)
26
37
 
27
38
  response = yield
28
39
 
29
- # 执行后置脚本
40
+ # 执行后置脚本(复用 _namespace,保留前置脚本中 import 的模块和定义的变量)
30
41
  teardown_scripts = data.get("teardown_script")
31
42
  if teardown_scripts and isinstance(teardown_scripts, str):
32
- exec(teardown_scripts)
43
+ exec(teardown_scripts, _namespace)
33
44
 
34
45
  yield
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: api_engine_xin
3
- Version: 0.0.29
3
+ Version: 0.0.30
4
4
  Summary: 接口测试平台测试用例执行引擎
5
5
  Home-page: https://pypi.org/project/api_engine_xin/
6
6
  Author: Shawn
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: api-engine-xin
3
- Version: 0.0.29
3
+ Version: 0.0.30
4
4
  Summary: 接口测试平台测试用例执行引擎
5
5
  Home-page: https://pypi.org/project/api_engine_xin/
6
6
  Author: Shawn
@@ -9,7 +9,7 @@ with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
9
9
 
10
10
  setup(
11
11
  name="api_engine_xin",
12
- version="0.0.29",
12
+ version="0.0.30",
13
13
  author="Shawn",
14
14
  author_email="xiaoh0525@xiaoh.com",
15
15
  description="接口测试平台测试用例执行引擎",
File without changes