pytest-dsl 0.15.3__py3-none-any.whl → 0.15.5__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.
- pytest_dsl/__init__.py +52 -3
- pytest_dsl/cli.py +8 -1
- pytest_dsl/core/context.py +82 -5
- pytest_dsl/core/custom_keyword_manager.py +14 -8
- pytest_dsl/core/dsl_executor.py +159 -35
- pytest_dsl/core/global_context.py +38 -8
- pytest_dsl/core/http_client.py +29 -5
- pytest_dsl/core/keyword_utils.py +7 -0
- pytest_dsl/core/remote_server_registry.py +333 -0
- pytest_dsl/core/serialization_utils.py +231 -0
- pytest_dsl/core/utils.py +34 -27
- pytest_dsl/core/variable_providers.py +202 -0
- pytest_dsl/core/variable_utils.py +45 -38
- pytest_dsl/core/yaml_loader.py +176 -36
- pytest_dsl/keywords/http_keywords.py +9 -5
- pytest_dsl/remote/__init__.py +63 -1
- pytest_dsl/remote/keyword_client.py +139 -55
- pytest_dsl/remote/keyword_server.py +32 -16
- {pytest_dsl-0.15.3.dist-info → pytest_dsl-0.15.5.dist-info}/METADATA +1 -1
- {pytest_dsl-0.15.3.dist-info → pytest_dsl-0.15.5.dist-info}/RECORD +24 -21
- {pytest_dsl-0.15.3.dist-info → pytest_dsl-0.15.5.dist-info}/WHEEL +0 -0
- {pytest_dsl-0.15.3.dist-info → pytest_dsl-0.15.5.dist-info}/entry_points.txt +0 -0
- {pytest_dsl-0.15.3.dist-info → pytest_dsl-0.15.5.dist-info}/licenses/LICENSE +0 -0
- {pytest_dsl-0.15.3.dist-info → pytest_dsl-0.15.5.dist-info}/top_level.txt +0 -0
pytest_dsl/remote/__init__.py
CHANGED
@@ -4,4 +4,66 @@ Remote module for pytest-dsl.
|
|
4
4
|
This module provides remote keyword server functionality.
|
5
5
|
"""
|
6
6
|
|
7
|
-
__version__ = "0.
|
7
|
+
__version__ = "0.15.5"
|
8
|
+
|
9
|
+
# 导出远程关键字管理器和相关功能
|
10
|
+
from .keyword_client import remote_keyword_manager, RemoteKeywordManager, RemoteKeywordClient
|
11
|
+
from .keyword_server import RemoteKeywordServer
|
12
|
+
from .variable_bridge import VariableBridge
|
13
|
+
|
14
|
+
# 导出便捷函数
|
15
|
+
|
16
|
+
|
17
|
+
def register_remote_server(url, alias, api_key=None, sync_config=None):
|
18
|
+
"""注册远程关键字服务器的便捷函数
|
19
|
+
|
20
|
+
Args:
|
21
|
+
url: 服务器URL
|
22
|
+
alias: 服务器别名
|
23
|
+
api_key: API密钥(可选)
|
24
|
+
sync_config: 变量同步配置(可选)
|
25
|
+
|
26
|
+
Returns:
|
27
|
+
bool: 是否成功连接
|
28
|
+
"""
|
29
|
+
return remote_keyword_manager.register_remote_server(url, alias, api_key, sync_config)
|
30
|
+
|
31
|
+
|
32
|
+
def register_multiple_servers(servers_config):
|
33
|
+
"""批量注册远程服务器
|
34
|
+
|
35
|
+
Args:
|
36
|
+
servers_config: 服务器配置列表,每个配置包含url、alias等信息
|
37
|
+
|
38
|
+
Returns:
|
39
|
+
dict: 注册结果,键为alias,值为是否成功
|
40
|
+
"""
|
41
|
+
results = {}
|
42
|
+
for server_config in servers_config:
|
43
|
+
if isinstance(server_config, dict):
|
44
|
+
url = server_config.get('url')
|
45
|
+
alias = server_config.get('alias')
|
46
|
+
api_key = server_config.get('api_key')
|
47
|
+
sync_config = server_config.get('sync_config')
|
48
|
+
|
49
|
+
if url and alias:
|
50
|
+
success = register_remote_server(
|
51
|
+
url, alias, api_key, sync_config)
|
52
|
+
results[alias] = success
|
53
|
+
|
54
|
+
return results
|
55
|
+
|
56
|
+
|
57
|
+
# 导出所有公共接口
|
58
|
+
__all__ = [
|
59
|
+
# 核心类
|
60
|
+
'remote_keyword_manager',
|
61
|
+
'RemoteKeywordManager',
|
62
|
+
'RemoteKeywordClient',
|
63
|
+
'RemoteKeywordServer',
|
64
|
+
'VariableBridge',
|
65
|
+
|
66
|
+
# 便捷函数
|
67
|
+
'register_remote_server',
|
68
|
+
'register_multiple_servers',
|
69
|
+
]
|
@@ -59,7 +59,7 @@ class RemoteKeywordClient:
|
|
59
59
|
try:
|
60
60
|
param_names = self.server.get_keyword_arguments(name)
|
61
61
|
doc = self.server.get_keyword_documentation(name)
|
62
|
-
|
62
|
+
|
63
63
|
# 尝试获取参数详细信息(包括默认值)
|
64
64
|
param_details = []
|
65
65
|
try:
|
@@ -87,7 +87,7 @@ class RemoteKeywordClient:
|
|
87
87
|
param_desc = param_detail.get('description',
|
88
88
|
f'远程关键字参数: {param_name}')
|
89
89
|
param_default = param_detail.get('default')
|
90
|
-
|
90
|
+
|
91
91
|
# 确保参数名称正确映射
|
92
92
|
parameters.append({
|
93
93
|
'name': param_name,
|
@@ -118,8 +118,10 @@ class RemoteKeywordClient:
|
|
118
118
|
'func': remote_func,
|
119
119
|
'mapping': {p['name']: p['mapping'] for p in parameters},
|
120
120
|
'parameters': [Parameter(**p) for p in parameters],
|
121
|
-
'defaults': {
|
122
|
-
|
121
|
+
'defaults': {
|
122
|
+
p['mapping']: p['default'] for p in parameters
|
123
|
+
if p['default'] is not None
|
124
|
+
}, # 添加默认值支持
|
123
125
|
'remote': True, # 标记为远程关键字
|
124
126
|
'alias': self.alias,
|
125
127
|
'original_name': name
|
@@ -131,7 +133,6 @@ class RemoteKeywordClient:
|
|
131
133
|
'doc': doc,
|
132
134
|
'param_details': param_details # 缓存详细参数信息
|
133
135
|
}
|
134
|
-
|
135
136
|
# 保存参数映射
|
136
137
|
self.param_mappings[name] = param_mapping
|
137
138
|
|
@@ -143,6 +144,9 @@ class RemoteKeywordClient:
|
|
143
144
|
"""执行远程关键字"""
|
144
145
|
name = kwargs.pop('name')
|
145
146
|
|
147
|
+
# 在执行前同步最新的上下文变量
|
148
|
+
self._sync_context_variables_before_execution(kwargs.get('context'))
|
149
|
+
|
146
150
|
# 移除context参数,因为它不能被序列化
|
147
151
|
if 'context' in kwargs:
|
148
152
|
kwargs.pop('context', None)
|
@@ -186,7 +190,6 @@ class RemoteKeywordClient:
|
|
186
190
|
if name in self.keyword_cache:
|
187
191
|
param_names = self.keyword_cache[name]['parameters']
|
188
192
|
print(f"远程关键字 {name} 的参数列表: {param_names}")
|
189
|
-
|
190
193
|
# 不再显示警告信息,因为参数已经在服务器端正确处理
|
191
194
|
# 服务器端会使用默认值或者报错,客户端不需要重复警告
|
192
195
|
|
@@ -209,7 +212,8 @@ class RemoteKeywordClient:
|
|
209
212
|
print(f"远程关键字捕获的变量: {return_data['captures']}")
|
210
213
|
|
211
214
|
# 处理会话状态
|
212
|
-
if 'session_state' in return_data and
|
215
|
+
if ('session_state' in return_data and
|
216
|
+
return_data['session_state']):
|
213
217
|
print(f"远程关键字会话状态: {return_data['session_state']}")
|
214
218
|
|
215
219
|
# 处理响应数据
|
@@ -217,7 +221,8 @@ class RemoteKeywordClient:
|
|
217
221
|
print("远程关键字响应数据: 已接收")
|
218
222
|
|
219
223
|
# 检查是否为新的统一返回格式(包含captures等字段)
|
220
|
-
if ('captures' in return_data or
|
224
|
+
if ('captures' in return_data or
|
225
|
+
'session_state' in return_data or
|
221
226
|
'metadata' in return_data):
|
222
227
|
# 返回完整的新格式,让DSL执行器处理变量捕获
|
223
228
|
return return_data
|
@@ -233,6 +238,72 @@ class RemoteKeywordClient:
|
|
233
238
|
traceback = '\n'.join(result.get('traceback', []))
|
234
239
|
raise Exception(f"远程关键字执行失败: {error_msg}\n{traceback}")
|
235
240
|
|
241
|
+
def _sync_context_variables_before_execution(self, context):
|
242
|
+
"""在执行远程关键字前同步最新的上下文变量
|
243
|
+
|
244
|
+
Args:
|
245
|
+
context: TestContext实例,如果为None则跳过同步
|
246
|
+
"""
|
247
|
+
if context is None:
|
248
|
+
return
|
249
|
+
|
250
|
+
try:
|
251
|
+
# 获取所有上下文变量
|
252
|
+
context_variables = context.get_all_context_variables()
|
253
|
+
|
254
|
+
if not context_variables:
|
255
|
+
print("没有上下文变量需要同步")
|
256
|
+
return
|
257
|
+
|
258
|
+
# 使用统一的序列化工具进行变量过滤
|
259
|
+
from pytest_dsl.core.serialization_utils import XMLRPCSerializer
|
260
|
+
|
261
|
+
# 扩展排除模式
|
262
|
+
exclude_patterns = self.sync_config.get('yaml_exclude_patterns', [
|
263
|
+
'password', 'secret', 'token', 'credential', 'auth',
|
264
|
+
'private', 'remote_servers'
|
265
|
+
])
|
266
|
+
|
267
|
+
variables_to_sync = XMLRPCSerializer.filter_variables(
|
268
|
+
context_variables, exclude_patterns)
|
269
|
+
|
270
|
+
if variables_to_sync:
|
271
|
+
# 调用远程服务器的变量同步接口
|
272
|
+
try:
|
273
|
+
result = self.server.sync_variables_from_client(
|
274
|
+
variables_to_sync, self.api_key)
|
275
|
+
if result.get('status') == 'success':
|
276
|
+
print(f"✅ 实时同步 {len(variables_to_sync)} 个上下文变量到远程服务器")
|
277
|
+
else:
|
278
|
+
print(f"❌ 实时同步变量失败: {result.get('error', '未知错误')}")
|
279
|
+
except Exception as e:
|
280
|
+
print(f"❌ 调用远程变量同步接口失败: {str(e)}")
|
281
|
+
else:
|
282
|
+
print("没有需要实时同步的变量")
|
283
|
+
|
284
|
+
except Exception as e:
|
285
|
+
logger.warning(f"实时变量同步失败: {str(e)}")
|
286
|
+
print(f"❌ 实时变量同步失败: {str(e)}")
|
287
|
+
|
288
|
+
def _collect_context_variables(self, context):
|
289
|
+
"""从TestContext收集所有变量(包括外部提供者变量)
|
290
|
+
|
291
|
+
Args:
|
292
|
+
context: TestContext实例
|
293
|
+
|
294
|
+
Returns:
|
295
|
+
dict: 包含所有上下文变量的字典
|
296
|
+
"""
|
297
|
+
if context is None:
|
298
|
+
return {}
|
299
|
+
|
300
|
+
try:
|
301
|
+
# 使用新的get_all_context_variables方法
|
302
|
+
return context.get_all_context_variables()
|
303
|
+
except Exception as e:
|
304
|
+
logger.warning(f"收集上下文变量失败: {str(e)}")
|
305
|
+
return {}
|
306
|
+
|
236
307
|
def _send_initial_variables(self):
|
237
308
|
"""连接时发送初始变量到远程服务器"""
|
238
309
|
try:
|
@@ -247,17 +318,28 @@ class RemoteKeywordClient:
|
|
247
318
|
variables_to_send.update(self._collect_yaml_variables())
|
248
319
|
|
249
320
|
if variables_to_send:
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
321
|
+
# 使用统一的序列化工具进行变量过滤和转换
|
322
|
+
from pytest_dsl.core.serialization_utils import (
|
323
|
+
XMLRPCSerializer
|
324
|
+
)
|
325
|
+
serializable_variables = XMLRPCSerializer.filter_variables(
|
326
|
+
variables_to_send)
|
327
|
+
|
328
|
+
if serializable_variables:
|
329
|
+
try:
|
330
|
+
# 调用远程服务器的变量接收接口
|
331
|
+
result = self.server.sync_variables_from_client(
|
332
|
+
serializable_variables, self.api_key)
|
333
|
+
if result.get('status') == 'success':
|
334
|
+
print(f"成功传递 {len(serializable_variables)} "
|
335
|
+
f"个变量到远程服务器")
|
336
|
+
else:
|
337
|
+
print(f"传递变量到远程服务器失败: "
|
338
|
+
f"{result.get('error', '未知错误')}")
|
339
|
+
except Exception as e:
|
340
|
+
print(f"调用远程变量接口失败: {str(e)}")
|
341
|
+
else:
|
342
|
+
print("没有可序列化的变量需要传递")
|
261
343
|
else:
|
262
344
|
print("没有需要传递的变量")
|
263
345
|
|
@@ -286,9 +368,17 @@ class RemoteKeywordClient:
|
|
286
368
|
with open(storage_file, 'r', encoding='utf-8') as f:
|
287
369
|
stored_vars = json.load(f)
|
288
370
|
# 只同步g_开头的全局变量
|
289
|
-
|
290
|
-
|
291
|
-
|
371
|
+
global_vars = {
|
372
|
+
name: value for name, value in stored_vars.items()
|
373
|
+
if name.startswith('g_')
|
374
|
+
}
|
375
|
+
if global_vars:
|
376
|
+
from pytest_dsl.core.serialization_utils import (
|
377
|
+
XMLRPCSerializer
|
378
|
+
)
|
379
|
+
filtered_global_vars = XMLRPCSerializer.filter_variables(
|
380
|
+
global_vars)
|
381
|
+
variables.update(filtered_global_vars)
|
292
382
|
except Exception as e:
|
293
383
|
logger.warning(f"收集全局变量失败: {str(e)}")
|
294
384
|
|
@@ -304,47 +394,41 @@ class RemoteKeywordClient:
|
|
304
394
|
yaml_data = yaml_vars._variables
|
305
395
|
if yaml_data:
|
306
396
|
print(f"客户端YAML变量总数: {len(yaml_data)}")
|
307
|
-
|
397
|
+
|
308
398
|
# 检查同步配置中是否指定了特定的键
|
309
399
|
sync_keys = self.sync_config.get('yaml_sync_keys', None)
|
310
|
-
exclude_patterns = self.sync_config.get(
|
311
|
-
'
|
312
|
-
|
313
|
-
|
400
|
+
exclude_patterns = self.sync_config.get(
|
401
|
+
'yaml_exclude_patterns', [
|
402
|
+
'password', 'secret', 'token', 'credential', 'auth',
|
403
|
+
'private', 'remote_servers' # 排除远程服务器配置避免循环
|
404
|
+
]
|
405
|
+
)
|
314
406
|
|
315
407
|
if sync_keys:
|
316
408
|
# 如果指定了特定键,只传递这些键,直接使用原始变量名
|
317
|
-
|
318
|
-
|
319
|
-
|
409
|
+
specific_vars = {
|
410
|
+
key: yaml_data[key] for key in sync_keys
|
411
|
+
if key in yaml_data
|
412
|
+
}
|
413
|
+
if specific_vars:
|
414
|
+
from pytest_dsl.core.serialization_utils import (
|
415
|
+
XMLRPCSerializer
|
416
|
+
)
|
417
|
+
filtered_specific_vars = XMLRPCSerializer.filter_variables(
|
418
|
+
specific_vars)
|
419
|
+
variables.update(filtered_specific_vars)
|
420
|
+
for key in filtered_specific_vars:
|
320
421
|
print(f"传递指定YAML变量: {key}")
|
321
422
|
else:
|
322
423
|
# 传递所有YAML变量,但排除敏感信息
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
break
|
332
|
-
|
333
|
-
# 如果值是字符串,也检查是否包含敏感信息
|
334
|
-
if not should_exclude and isinstance(value, str):
|
335
|
-
value_lower = value.lower()
|
336
|
-
for pattern in exclude_patterns:
|
337
|
-
if (pattern.lower() in value_lower and
|
338
|
-
len(value) < 100): # 只检查短字符串
|
339
|
-
should_exclude = True
|
340
|
-
break
|
341
|
-
|
342
|
-
if not should_exclude:
|
343
|
-
# 直接使用原始变量名,不添加yaml_前缀,实现无缝传递
|
344
|
-
variables[key] = value
|
345
|
-
print(f"传递YAML变量: {key}")
|
346
|
-
else:
|
347
|
-
print(f"跳过敏感YAML变量: {key}")
|
424
|
+
from pytest_dsl.core.serialization_utils import (
|
425
|
+
XMLRPCSerializer
|
426
|
+
)
|
427
|
+
filtered_yaml_vars = XMLRPCSerializer.filter_variables(
|
428
|
+
yaml_data, exclude_patterns)
|
429
|
+
variables.update(filtered_yaml_vars)
|
430
|
+
for key in filtered_yaml_vars:
|
431
|
+
print(f"传递YAML变量: {key}")
|
348
432
|
|
349
433
|
except Exception as e:
|
350
434
|
logger.warning(f"收集YAML变量失败: {str(e)}")
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import xmlrpc.server
|
2
|
-
from functools import partial
|
3
2
|
import inspect
|
4
3
|
import json
|
5
4
|
import sys
|
@@ -8,12 +7,10 @@ import signal
|
|
8
7
|
import atexit
|
9
8
|
import threading
|
10
9
|
import time
|
11
|
-
from typing import Dict, Any, Callable, List
|
12
10
|
|
13
11
|
from pytest_dsl.core.keyword_manager import keyword_manager
|
14
12
|
from pytest_dsl.remote.hook_manager import hook_manager, HookType
|
15
|
-
|
16
|
-
from pytest_dsl.remote import variable_bridge
|
13
|
+
|
17
14
|
|
18
15
|
class RemoteKeywordServer:
|
19
16
|
"""远程关键字服务器,提供关键字的远程调用能力"""
|
@@ -35,7 +32,9 @@ class RemoteKeywordServer:
|
|
35
32
|
|
36
33
|
def _register_builtin_keywords(self):
|
37
34
|
"""注册所有内置关键字,复用本地模式的加载逻辑"""
|
38
|
-
from pytest_dsl.core.plugin_discovery import
|
35
|
+
from pytest_dsl.core.plugin_discovery import (
|
36
|
+
load_all_plugins, scan_local_keywords
|
37
|
+
)
|
39
38
|
|
40
39
|
# 0. 首先加载内置关键字模块(确保内置关键字被注册)
|
41
40
|
print("正在加载内置关键字...")
|
@@ -63,7 +62,8 @@ class RemoteKeywordServer:
|
|
63
62
|
print(f"接收到信号 {signum},正在关闭服务器...")
|
64
63
|
|
65
64
|
# 在新线程中执行关闭逻辑,避免阻塞信号处理器
|
66
|
-
shutdown_thread = threading.Thread(
|
65
|
+
shutdown_thread = threading.Thread(
|
66
|
+
target=self._shutdown_in_thread, daemon=True)
|
67
67
|
shutdown_thread.start()
|
68
68
|
|
69
69
|
# 保存信号处理器引用
|
@@ -119,7 +119,8 @@ class RemoteKeywordServer:
|
|
119
119
|
def start(self):
|
120
120
|
"""启动远程关键字服务器"""
|
121
121
|
try:
|
122
|
-
self.server = xmlrpc.server.SimpleXMLRPCServer(
|
122
|
+
self.server = xmlrpc.server.SimpleXMLRPCServer(
|
123
|
+
(self.host, self.port), allow_none=True)
|
123
124
|
except OSError as e:
|
124
125
|
if "Address already in use" in str(e):
|
125
126
|
print(f"端口 {self.port} 已被占用,请使用其他端口或关闭占用该端口的进程")
|
@@ -207,7 +208,8 @@ class RemoteKeywordServer:
|
|
207
208
|
try:
|
208
209
|
# 确保参数是字典格式
|
209
210
|
if not isinstance(args_dict, dict):
|
210
|
-
args_dict = json.loads(args_dict) if isinstance(
|
211
|
+
args_dict = json.loads(args_dict) if isinstance(
|
212
|
+
args_dict, str) else {}
|
211
213
|
|
212
214
|
# 获取关键字信息
|
213
215
|
keyword_info = keyword_manager.get_keyword_info(name)
|
@@ -226,6 +228,15 @@ class RemoteKeywordServer:
|
|
226
228
|
# 创建测试上下文(所有关键字都需要)
|
227
229
|
from pytest_dsl.core.context import TestContext
|
228
230
|
test_context = TestContext()
|
231
|
+
|
232
|
+
# 设置变量提供者,确保可以访问YAML变量和全局变量
|
233
|
+
try:
|
234
|
+
from pytest_dsl.core.variable_providers import setup_context_with_default_providers
|
235
|
+
setup_context_with_default_providers(test_context)
|
236
|
+
except ImportError:
|
237
|
+
# 如果导入失败,记录警告但继续执行
|
238
|
+
print("警告:无法设置变量提供者")
|
239
|
+
|
229
240
|
exec_kwargs['context'] = test_context
|
230
241
|
|
231
242
|
# 映射参数(通用逻辑)
|
@@ -292,10 +303,10 @@ class RemoteKeywordServer:
|
|
292
303
|
|
293
304
|
def get_keyword_parameter_details(self, name):
|
294
305
|
"""获取关键字的参数详细信息,包括默认值
|
295
|
-
|
306
|
+
|
296
307
|
Args:
|
297
308
|
name: 关键字名称
|
298
|
-
|
309
|
+
|
299
310
|
Returns:
|
300
311
|
list: 参数详细信息列表,每个元素包含name, mapping, description, default
|
301
312
|
"""
|
@@ -311,7 +322,7 @@ class RemoteKeywordServer:
|
|
311
322
|
'description': param.description,
|
312
323
|
'default': param.default
|
313
324
|
})
|
314
|
-
|
325
|
+
|
315
326
|
return param_details
|
316
327
|
|
317
328
|
def get_keyword_documentation(self, name):
|
@@ -405,7 +416,7 @@ class RemoteKeywordServer:
|
|
405
416
|
|
406
417
|
# 将所有同步的变量直接注入到yaml_vars中,实现无缝访问
|
407
418
|
from pytest_dsl.core.yaml_vars import yaml_vars
|
408
|
-
|
419
|
+
|
409
420
|
for name, value in variables.items():
|
410
421
|
# 直接设置到yaml_vars中,确保所有关键字都能无缝访问
|
411
422
|
yaml_vars._variables[name] = value
|
@@ -419,7 +430,7 @@ class RemoteKeywordServer:
|
|
419
430
|
print(f"✓ 全局变量 {name} 已注入到global_context")
|
420
431
|
|
421
432
|
print(f"✅ 总共同步了 {len(variables)} 个变量,全部实现无缝访问")
|
422
|
-
|
433
|
+
|
423
434
|
return {
|
424
435
|
'status': 'success',
|
425
436
|
'message': f'成功同步 {len(variables)} 个变量,全部实现无缝访问'
|
@@ -550,6 +561,7 @@ class RemoteKeywordServer:
|
|
550
561
|
'error': f'列出变量失败: {str(e)}'
|
551
562
|
}
|
552
563
|
|
564
|
+
|
553
565
|
def main():
|
554
566
|
"""启动远程关键字服务器的主函数"""
|
555
567
|
import argparse
|
@@ -572,7 +584,8 @@ def main():
|
|
572
584
|
_auto_load_extensions()
|
573
585
|
|
574
586
|
# 创建并启动服务器(服务器初始化时会自动加载标准关键字)
|
575
|
-
server = RemoteKeywordServer(
|
587
|
+
server = RemoteKeywordServer(
|
588
|
+
host=args.host, port=args.port, api_key=args.api_key)
|
576
589
|
server.start()
|
577
590
|
|
578
591
|
|
@@ -591,7 +604,8 @@ def _load_extensions(extensions_arg):
|
|
591
604
|
if os.path.isfile(ext_path) and ext_path.endswith('.py'):
|
592
605
|
# 加载单个Python文件
|
593
606
|
module_name = os.path.splitext(os.path.basename(ext_path))[0]
|
594
|
-
spec = importlib.util.spec_from_file_location(
|
607
|
+
spec = importlib.util.spec_from_file_location(
|
608
|
+
module_name, ext_path)
|
595
609
|
module = importlib.util.module_from_spec(spec)
|
596
610
|
spec.loader.exec_module(module)
|
597
611
|
print(f"已加载扩展模块: {ext_path}")
|
@@ -601,7 +615,8 @@ def _load_extensions(extensions_arg):
|
|
601
615
|
if filename.endswith('.py') and not filename.startswith('_'):
|
602
616
|
file_path = os.path.join(ext_path, filename)
|
603
617
|
module_name = os.path.splitext(filename)[0]
|
604
|
-
spec = importlib.util.spec_from_file_location(
|
618
|
+
spec = importlib.util.spec_from_file_location(
|
619
|
+
module_name, file_path)
|
605
620
|
module = importlib.util.module_from_spec(spec)
|
606
621
|
spec.loader.exec_module(module)
|
607
622
|
print(f"已加载扩展模块: {file_path}")
|
@@ -631,5 +646,6 @@ def _auto_load_extensions():
|
|
631
646
|
print(f"发现扩展文件: {remote_ext_file}")
|
632
647
|
_load_extensions(remote_ext_file)
|
633
648
|
|
649
|
+
|
634
650
|
if __name__ == '__main__':
|
635
651
|
main()
|
@@ -1,5 +1,5 @@
|
|
1
|
-
pytest_dsl/__init__.py,sha256=
|
2
|
-
pytest_dsl/cli.py,sha256=
|
1
|
+
pytest_dsl/__init__.py,sha256=Mb4fBll66yNvWOpESky6GF-iHFrdroeS5yRwUOCAs0Q,6813
|
2
|
+
pytest_dsl/cli.py,sha256=kuCEp0FOmlbes8CreAugSwYyU8yoU_oG3HzSGSFh2Cs,13246
|
3
3
|
pytest_dsl/conftest_adapter.py,sha256=cevEb0oEZKTZfUrGe1-CmkFByxKhUtjuurBJP7kpLc0,149
|
4
4
|
pytest_dsl/main_adapter.py,sha256=pUIPN_EzY3JCDlYK7yF_OeLDVqni8vtG15G7gVzPJXg,181
|
5
5
|
pytest_dsl/plugin.py,sha256=CEwi-ci2rMevaAl9PwBw2WKXWRbXuHI1IkkDV0I0VIo,2224
|
@@ -7,29 +7,32 @@ pytest_dsl/core/__init__.py,sha256=ersUoxIWSrisxs9GX_STlH4XAbjNxAWUQB0NboaC5zI,3
|
|
7
7
|
pytest_dsl/core/auth_provider.py,sha256=IZfXXrr4Uuc8QHwRPvhHSzNa2fwrqhjYts1xh78D39Q,14861
|
8
8
|
pytest_dsl/core/auto_decorator.py,sha256=9Mga-GB4AzV5nkB6zpfaq8IuHa0KOH8LlFvnWyH_tnU,6623
|
9
9
|
pytest_dsl/core/auto_directory.py,sha256=egyTnVxtGs4P75EIivRauLRPJfN9aZpoGVvp_Ma72AM,2714
|
10
|
-
pytest_dsl/core/context.py,sha256=
|
11
|
-
pytest_dsl/core/custom_keyword_manager.py,sha256=
|
12
|
-
pytest_dsl/core/dsl_executor.py,sha256=
|
10
|
+
pytest_dsl/core/context.py,sha256=F6c8U2jSNNqiI_QUn6rn_6pcIi-H_M9bthH-gu92P-0,3985
|
11
|
+
pytest_dsl/core/custom_keyword_manager.py,sha256=SSlsCv3GFMqmtORrqp2I70DvI5vjcBHUgofCgQATbtk,16272
|
12
|
+
pytest_dsl/core/dsl_executor.py,sha256=r1lGlakj5PXWguUnQdEoDCaMr6_jYQTizFHEwZkiY5k,65223
|
13
13
|
pytest_dsl/core/dsl_executor_utils.py,sha256=ZJLSYSsiKHqg53d3Bl--ZF8m9abd5kpqdevWl31KEZg,2276
|
14
14
|
pytest_dsl/core/execution_tracker.py,sha256=Pwcxraxt_xkOouq32KBqola-OVfnbaomCoMTyUIqoN4,9476
|
15
|
-
pytest_dsl/core/global_context.py,sha256=
|
15
|
+
pytest_dsl/core/global_context.py,sha256=1wU0I1fd5I9K3rX90hu6BaodynnYRQNFBFhcecO5eQE,4629
|
16
16
|
pytest_dsl/core/hook_manager.py,sha256=rqpcj9tBcxwFpoU2ZAfOWO8P0oyq02Ie_XUjq-9vFc0,2445
|
17
17
|
pytest_dsl/core/hookable_executor.py,sha256=sxkyWF7bSkKzgVoNwUTvtDGOSgFKXXQHR5uYIf-9MaM,3969
|
18
18
|
pytest_dsl/core/hookable_keyword_manager.py,sha256=e_guTVF1tU3pu_uzAUd4xNudFlYth42Ll2ESeRLlpjE,3833
|
19
19
|
pytest_dsl/core/hookspecs.py,sha256=fBmvs8uIV9_M_FUQBgvHSDn51Z6ABXo9k0okf80wzeo,5071
|
20
|
-
pytest_dsl/core/http_client.py,sha256=
|
20
|
+
pytest_dsl/core/http_client.py,sha256=h4RMCkfMYlKx2kdF53mcCJ-udux9q7LxsIeSXwXZt6o,16263
|
21
21
|
pytest_dsl/core/http_request.py,sha256=6e-gTztH3wu2eSW27Nc0uPmyWjB6oBwndx8Vqnu5uyg,60030
|
22
22
|
pytest_dsl/core/keyword_loader.py,sha256=3GQ4w5Zf2XdkoJ85uYXh9YB93_8L8OAb7vvuKE3-gVA,13864
|
23
23
|
pytest_dsl/core/keyword_manager.py,sha256=5WZWwlYk74kGHh1T6WjCuVd8eelq2-UEXvDIe4U7rEI,7730
|
24
|
-
pytest_dsl/core/keyword_utils.py,sha256=
|
24
|
+
pytest_dsl/core/keyword_utils.py,sha256=ONZxQJ0W7_knLGJpRdZvZ1srHLFybMuUZKI1wxoeaJA,20195
|
25
25
|
pytest_dsl/core/lexer.py,sha256=o_EJIadfhgyCImI73Y9ybqlBE9AisgA6nOhxpXNlaMw,4648
|
26
26
|
pytest_dsl/core/parser.py,sha256=SvTQ4jgMSe3MITSu9PftraElPAzVaBbNPHMEk1H_lFY,16597
|
27
27
|
pytest_dsl/core/parsetab.py,sha256=o4XbFKwpsi3fYmfI_F6u5NSM61Qp6gTx-Sfh1jDINxI,31767
|
28
28
|
pytest_dsl/core/plugin_discovery.py,sha256=3pt3EXJ7EPF0rkUlyDZMVHkIiTy2vicdIIQJkrHXZjY,8305
|
29
|
-
pytest_dsl/core/
|
29
|
+
pytest_dsl/core/remote_server_registry.py,sha256=MqAf2w0W_5D-zSClD87f9JDNQv-irZ4BrS03dcOFGU0,11046
|
30
|
+
pytest_dsl/core/serialization_utils.py,sha256=b51uywA13vLU_G8rKFVl_BovN7A6mT-XYvn99OpqF54,8303
|
31
|
+
pytest_dsl/core/utils.py,sha256=yAe-PtPTB7gSy8xa_V9UBk4L5SELvTEKiAhkiG4_2rM,5374
|
30
32
|
pytest_dsl/core/validator.py,sha256=2mjw7yiDEMu80FjJ_y2KCS-vA1Tb4kotrKkmLwpRe8Y,17420
|
31
|
-
pytest_dsl/core/
|
32
|
-
pytest_dsl/core/
|
33
|
+
pytest_dsl/core/variable_providers.py,sha256=ee81Pzy3GlU7q4taoSSd5E7YW87iPdusH0TfxV-0aUw,6198
|
34
|
+
pytest_dsl/core/variable_utils.py,sha256=5vB_0fnVaYyZ6rv23tv7kAyp_4xM8F3FIjxYrx3xen0,13927
|
35
|
+
pytest_dsl/core/yaml_loader.py,sha256=Lvut8-RKaVC4Gfv09XTVoagX1W1JKXgiJFMv8P8R9o0,14372
|
33
36
|
pytest_dsl/core/yaml_vars.py,sha256=PqbCGT_TmOXH09Pmm72sYtMEvV-sp9ocLqkuAUQYhhc,5047
|
34
37
|
pytest_dsl/docs/custom_keywords.md,sha256=03dA_GeHxoLixA8Sqch14bhTbxXQCSfz9Kvged2fMCo,4381
|
35
38
|
pytest_dsl/examples/__init__.py,sha256=FKkyLFOjxfC6XnJlW7iK_BUIX9dTIpXgoYN1pfs91ss,84
|
@@ -65,17 +68,17 @@ pytest_dsl/examples/quickstart/loops.auto,sha256=ZNZ6qP636v8QMY8QRyTUBB43gWCsqHb
|
|
65
68
|
pytest_dsl/keywords/__init__.py,sha256=5aiyPU_t1UiB2MEZ6M9ffOKnV1mFT_2YHxnZvyWaBNI,372
|
66
69
|
pytest_dsl/keywords/assertion_keywords.py,sha256=obW06H_3AizsvEM_9VE2JVuwvgrNVqP1kUTDd3U1SMk,23240
|
67
70
|
pytest_dsl/keywords/global_keywords.py,sha256=4yw5yeXoGf_4W26F39EA2Pp-mH9GiKGy2jKgFO9a_wM,2509
|
68
|
-
pytest_dsl/keywords/http_keywords.py,sha256=
|
71
|
+
pytest_dsl/keywords/http_keywords.py,sha256=NMOLqD9m7iNLIYKnkQiinZilgLNopd2QzxRgmnliaNc,28976
|
69
72
|
pytest_dsl/keywords/system_keywords.py,sha256=hjsACYER87rseSj4thBFnjDqe6At5hBT4Gjifj4ulDE,24470
|
70
|
-
pytest_dsl/remote/__init__.py,sha256=
|
73
|
+
pytest_dsl/remote/__init__.py,sha256=qNoYEZKl0m5GtDsl5YhLBOhw9Qn0x9lMrmX79ZZxOq8,1844
|
71
74
|
pytest_dsl/remote/hook_manager.py,sha256=0hwRKP8yhcnfAnrrnZGVT-S0TBgo6c0A4qO5XRpvV1U,4899
|
72
|
-
pytest_dsl/remote/keyword_client.py,sha256=
|
73
|
-
pytest_dsl/remote/keyword_server.py,sha256=
|
75
|
+
pytest_dsl/remote/keyword_client.py,sha256=HjVfZxvn549bo9-QYobIubVa4Knch8y5EVvNuVVJEM8,20572
|
76
|
+
pytest_dsl/remote/keyword_server.py,sha256=XSU8ojOhNV5WtvYNwn_HYiAulj7_L35IvtG7FECqGVo,22668
|
74
77
|
pytest_dsl/remote/variable_bridge.py,sha256=dv-d3Gq9ttvvrXM1fdlLtoSOPB6vRp0_GBOwX4wvcy8,7121
|
75
78
|
pytest_dsl/templates/keywords_report.html,sha256=7x84iq6hi08nf1iQ95jZ3izcAUPx6JFm0_8xS85CYws,31241
|
76
|
-
pytest_dsl-0.15.
|
77
|
-
pytest_dsl-0.15.
|
78
|
-
pytest_dsl-0.15.
|
79
|
-
pytest_dsl-0.15.
|
80
|
-
pytest_dsl-0.15.
|
81
|
-
pytest_dsl-0.15.
|
79
|
+
pytest_dsl-0.15.5.dist-info/licenses/LICENSE,sha256=Rguy8cb9sYhK6cmrBdXvwh94rKVDh2tVZEWptsHIsVM,1071
|
80
|
+
pytest_dsl-0.15.5.dist-info/METADATA,sha256=I9tSZQifKuUGk0wE_avhfYNMCYaGdaNKikY4l6o_srA,29655
|
81
|
+
pytest_dsl-0.15.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
82
|
+
pytest_dsl-0.15.5.dist-info/entry_points.txt,sha256=PLOBbH02OGY1XR1JDKIZB1Em87loUvbgMRWaag-5FhY,204
|
83
|
+
pytest_dsl-0.15.5.dist-info/top_level.txt,sha256=4CrSx4uNqxj7NvK6k1y2JZrSrJSzi-UvPZdqpUhumWM,11
|
84
|
+
pytest_dsl-0.15.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|