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.
- cli.py +9 -0
- common/__init__.py +0 -0
- common/setting.py +78 -0
- pytest_auto_api2/__init__.py +4 -0
- pytest_auto_api2/cli.py +900 -0
- pytest_auto_api2/runtime/__init__.py +1 -0
- pytest_auto_api2/runtime/api.py +10 -0
- pytest_auto_api2/runtime/loader.py +80 -0
- pytest_auto_api2_cli-0.2.0.dist-info/METADATA +945 -0
- pytest_auto_api2_cli-0.2.0.dist-info/RECORD +73 -0
- pytest_auto_api2_cli-0.2.0.dist-info/WHEEL +5 -0
- pytest_auto_api2_cli-0.2.0.dist-info/entry_points.txt +2 -0
- pytest_auto_api2_cli-0.2.0.dist-info/top_level.txt +6 -0
- run.py +85 -0
- test_case/Collect/test_collect_addtool.py +40 -0
- test_case/Collect/test_collect_delete_tool.py +40 -0
- test_case/Collect/test_collect_tool_list.py +40 -0
- test_case/Collect/test_collect_update_tool.py +40 -0
- test_case/Login/test_login.py +40 -0
- test_case/UserInfo/test_get_user_info.py +40 -0
- test_case/__init__.py +6 -0
- test_case/conftest.py +132 -0
- utils/__init__.py +9 -0
- utils/assertion/__init__.py +4 -0
- utils/assertion/assert_control.py +179 -0
- utils/assertion/assert_type.py +141 -0
- utils/cache_process/__init__.py +4 -0
- utils/cache_process/cache_control.py +89 -0
- utils/cache_process/redis_control.py +106 -0
- utils/logging_tool/__init__.py +4 -0
- utils/logging_tool/log_control.py +84 -0
- utils/logging_tool/log_decorator.py +48 -0
- utils/logging_tool/run_time_decorator.py +34 -0
- utils/mysql_tool/__init__.py +4 -0
- utils/mysql_tool/mysql_control.py +175 -0
- utils/notify/__init__.py +1 -0
- utils/notify/ding_talk.py +153 -0
- utils/notify/lark.py +181 -0
- utils/notify/send_mail.py +84 -0
- utils/notify/wechat_send.py +109 -0
- utils/other_tools/__init__.py +0 -0
- utils/other_tools/address_detection.py +73 -0
- utils/other_tools/allure_data/__init__.py +4 -0
- utils/other_tools/allure_data/allure_report_data.py +84 -0
- utils/other_tools/allure_data/allure_tools.py +54 -0
- utils/other_tools/allure_data/error_case_excel.py +316 -0
- utils/other_tools/exceptions.py +47 -0
- utils/other_tools/get_local_ip.py +27 -0
- utils/other_tools/install_tool/__init__.py +0 -0
- utils/other_tools/install_tool/install_requirements.py +91 -0
- utils/other_tools/jsonpath_date_replace.py +28 -0
- utils/other_tools/models.py +269 -0
- utils/other_tools/thread_tool.py +91 -0
- utils/read_files_tools/__init__.py +1 -0
- utils/read_files_tools/case_automatic_control.py +138 -0
- utils/read_files_tools/clean_files.py +19 -0
- utils/read_files_tools/excel_control.py +55 -0
- utils/read_files_tools/get_all_files_path.py +27 -0
- utils/read_files_tools/get_yaml_data_analysis.py +156 -0
- utils/read_files_tools/regular_control.py +209 -0
- utils/read_files_tools/swagger_for_yaml.py +145 -0
- utils/read_files_tools/testcase_template.py +103 -0
- utils/read_files_tools/yaml_control.py +86 -0
- utils/recording/__init__.py +0 -0
- utils/recording/mitmproxy_control.py +225 -0
- utils/requests_tool/__init__.py +0 -0
- utils/requests_tool/dependent_case.py +273 -0
- utils/requests_tool/encryption_algorithm_control.py +80 -0
- utils/requests_tool/request_control.py +443 -0
- utils/requests_tool/set_current_request_cache.py +73 -0
- utils/requests_tool/teardown_control.py +280 -0
- utils/times_tool/__init__.py +0 -0
- utils/times_tool/time_control.py +87 -0
cli.py
ADDED
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")
|