pytest-auto-api2-cli 0.2.0__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.
Files changed (73) hide show
  1. cli.py +9 -0
  2. common/__init__.py +0 -0
  3. common/setting.py +78 -0
  4. pytest_auto_api2/__init__.py +4 -0
  5. pytest_auto_api2/cli.py +900 -0
  6. pytest_auto_api2/runtime/__init__.py +1 -0
  7. pytest_auto_api2/runtime/api.py +10 -0
  8. pytest_auto_api2/runtime/loader.py +80 -0
  9. pytest_auto_api2_cli-0.2.0.dist-info/METADATA +945 -0
  10. pytest_auto_api2_cli-0.2.0.dist-info/RECORD +73 -0
  11. pytest_auto_api2_cli-0.2.0.dist-info/WHEEL +5 -0
  12. pytest_auto_api2_cli-0.2.0.dist-info/entry_points.txt +2 -0
  13. pytest_auto_api2_cli-0.2.0.dist-info/top_level.txt +6 -0
  14. run.py +85 -0
  15. test_case/Collect/test_collect_addtool.py +40 -0
  16. test_case/Collect/test_collect_delete_tool.py +40 -0
  17. test_case/Collect/test_collect_tool_list.py +40 -0
  18. test_case/Collect/test_collect_update_tool.py +40 -0
  19. test_case/Login/test_login.py +40 -0
  20. test_case/UserInfo/test_get_user_info.py +40 -0
  21. test_case/__init__.py +6 -0
  22. test_case/conftest.py +132 -0
  23. utils/__init__.py +9 -0
  24. utils/assertion/__init__.py +4 -0
  25. utils/assertion/assert_control.py +179 -0
  26. utils/assertion/assert_type.py +141 -0
  27. utils/cache_process/__init__.py +4 -0
  28. utils/cache_process/cache_control.py +89 -0
  29. utils/cache_process/redis_control.py +106 -0
  30. utils/logging_tool/__init__.py +4 -0
  31. utils/logging_tool/log_control.py +84 -0
  32. utils/logging_tool/log_decorator.py +48 -0
  33. utils/logging_tool/run_time_decorator.py +34 -0
  34. utils/mysql_tool/__init__.py +4 -0
  35. utils/mysql_tool/mysql_control.py +175 -0
  36. utils/notify/__init__.py +1 -0
  37. utils/notify/ding_talk.py +153 -0
  38. utils/notify/lark.py +181 -0
  39. utils/notify/send_mail.py +84 -0
  40. utils/notify/wechat_send.py +109 -0
  41. utils/other_tools/__init__.py +0 -0
  42. utils/other_tools/address_detection.py +73 -0
  43. utils/other_tools/allure_data/__init__.py +4 -0
  44. utils/other_tools/allure_data/allure_report_data.py +84 -0
  45. utils/other_tools/allure_data/allure_tools.py +54 -0
  46. utils/other_tools/allure_data/error_case_excel.py +316 -0
  47. utils/other_tools/exceptions.py +47 -0
  48. utils/other_tools/get_local_ip.py +27 -0
  49. utils/other_tools/install_tool/__init__.py +0 -0
  50. utils/other_tools/install_tool/install_requirements.py +91 -0
  51. utils/other_tools/jsonpath_date_replace.py +28 -0
  52. utils/other_tools/models.py +269 -0
  53. utils/other_tools/thread_tool.py +91 -0
  54. utils/read_files_tools/__init__.py +1 -0
  55. utils/read_files_tools/case_automatic_control.py +138 -0
  56. utils/read_files_tools/clean_files.py +19 -0
  57. utils/read_files_tools/excel_control.py +55 -0
  58. utils/read_files_tools/get_all_files_path.py +27 -0
  59. utils/read_files_tools/get_yaml_data_analysis.py +156 -0
  60. utils/read_files_tools/regular_control.py +209 -0
  61. utils/read_files_tools/swagger_for_yaml.py +145 -0
  62. utils/read_files_tools/testcase_template.py +103 -0
  63. utils/read_files_tools/yaml_control.py +86 -0
  64. utils/recording/__init__.py +0 -0
  65. utils/recording/mitmproxy_control.py +225 -0
  66. utils/requests_tool/__init__.py +0 -0
  67. utils/requests_tool/dependent_case.py +273 -0
  68. utils/requests_tool/encryption_algorithm_control.py +80 -0
  69. utils/requests_tool/request_control.py +443 -0
  70. utils/requests_tool/set_current_request_cache.py +73 -0
  71. utils/requests_tool/teardown_control.py +280 -0
  72. utils/times_tool/__init__.py +0 -0
  73. utils/times_tool/time_control.py +87 -0
cli.py ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """Backward-compatible CLI shim."""
4
+
5
+ from pytest_auto_api2.cli import main
6
+
7
+
8
+ if __name__ == "__main__":
9
+ raise SystemExit(main())
common/__init__.py ADDED
File without changes
common/setting.py ADDED
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Time : 2021/11/25 13:07
4
+ # @Author : 浣欏皯鐞?
5
+
6
+ import os
7
+ from typing import Text
8
+
9
+ PROJECT_ROOT_ENV = "PYTEST_AUTO_API2_HOME"
10
+ CONFIG_PATH_ENV = "PYTEST_AUTO_API2_CONFIG"
11
+ DATA_DIR_ENV = "PYTEST_AUTO_API2_DATA_DIR"
12
+ TEST_DIR_ENV = "PYTEST_AUTO_API2_TEST_DIR"
13
+
14
+
15
+ def _normalize_sep(path: Text) -> Text:
16
+ """Normalize path separators for current OS."""
17
+ if "/" in path:
18
+ path = os.sep.join(path.split("/"))
19
+ if "\\" in path:
20
+ path = os.sep.join(path.split("\\"))
21
+ return path
22
+
23
+
24
+ def root_path() -> Text:
25
+ """Return project root path."""
26
+ env_root = os.getenv(PROJECT_ROOT_ENV)
27
+ if env_root:
28
+ return os.path.abspath(env_root)
29
+ return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
30
+
31
+
32
+ def resolve_project_path(path: Text) -> Text:
33
+ """Resolve absolute path with project root as base for relative values."""
34
+ if path is None:
35
+ return root_path()
36
+ normalized = _normalize_sep(str(path))
37
+ if os.path.isabs(normalized):
38
+ return os.path.abspath(normalized)
39
+ return os.path.abspath(os.path.join(root_path(), normalized))
40
+
41
+
42
+ def ensure_path_sep(path: Text) -> Text:
43
+ """Build absolute path under project root while preserving compatibility."""
44
+ normalized = _normalize_sep(path)
45
+ drive, _ = os.path.splitdrive(normalized)
46
+
47
+ # Keep historical behavior: `\`-prefixed paths are project-root relative.
48
+ if normalized.startswith(os.sep) and not drive:
49
+ return os.path.abspath(root_path() + normalized)
50
+
51
+ if os.path.isabs(normalized):
52
+ return os.path.abspath(normalized)
53
+
54
+ return os.path.abspath(os.path.join(root_path(), normalized))
55
+
56
+
57
+ def config_path() -> Text:
58
+ """Return active config path."""
59
+ env_config = os.getenv(CONFIG_PATH_ENV)
60
+ if env_config:
61
+ return resolve_project_path(env_config)
62
+ return ensure_path_sep("\\common\\config.yaml")
63
+
64
+
65
+ def data_dir_path() -> Text:
66
+ """Return active yaml data directory."""
67
+ env_data = os.getenv(DATA_DIR_ENV)
68
+ if env_data:
69
+ return resolve_project_path(env_data)
70
+ return ensure_path_sep("\\data")
71
+
72
+
73
+ def test_case_dir_path() -> Text:
74
+ """Return active generated test directory."""
75
+ env_test = os.getenv(TEST_DIR_ENV)
76
+ if env_test:
77
+ return resolve_project_path(env_test)
78
+ return ensure_path_sep("\\test_case")
@@ -0,0 +1,4 @@
1
+ """pytest-auto-api2 namespace package."""
2
+
3
+ __all__ = ["__version__"]
4
+ __version__ = "0.2.0"