pytest-dsl 0.15.0__py3-none-any.whl → 0.15.2__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 +12 -0
- pytest_dsl/cli.py +15 -427
- pytest_dsl/core/dsl_executor.py +598 -339
- pytest_dsl/core/keyword_utils.py +609 -0
- pytest_dsl/core/lexer.py +8 -0
- pytest_dsl/core/parser.py +55 -3
- {pytest_dsl-0.15.0.dist-info → pytest_dsl-0.15.2.dist-info}/METADATA +1 -1
- {pytest_dsl-0.15.0.dist-info → pytest_dsl-0.15.2.dist-info}/RECORD +12 -11
- {pytest_dsl-0.15.0.dist-info → pytest_dsl-0.15.2.dist-info}/WHEEL +0 -0
- {pytest_dsl-0.15.0.dist-info → pytest_dsl-0.15.2.dist-info}/entry_points.txt +0 -0
- {pytest_dsl-0.15.0.dist-info → pytest_dsl-0.15.2.dist-info}/licenses/LICENSE +0 -0
- {pytest_dsl-0.15.0.dist-info → pytest_dsl-0.15.2.dist-info}/top_level.txt +0 -0
pytest_dsl/core/parser.py
CHANGED
@@ -198,7 +198,30 @@ def p_expr_atom(p):
|
|
198
198
|
elif isinstance(p[1], Node):
|
199
199
|
p[0] = p[1]
|
200
200
|
else:
|
201
|
-
|
201
|
+
# 为基本表达式设置行号信息和类型信息
|
202
|
+
expr_line = getattr(p.slice[1], 'lineno', None)
|
203
|
+
|
204
|
+
# 根据token类型创建不同的节点类型
|
205
|
+
token_type = p.slice[1].type
|
206
|
+
if token_type == 'STRING':
|
207
|
+
# 字符串字面量
|
208
|
+
expr_node = Node('StringLiteral', value=p[1])
|
209
|
+
elif token_type == 'NUMBER':
|
210
|
+
# 数字字面量
|
211
|
+
expr_node = Node('NumberLiteral', value=p[1])
|
212
|
+
elif token_type == 'ID':
|
213
|
+
# 变量引用
|
214
|
+
expr_node = Node('VariableRef', value=p[1])
|
215
|
+
elif token_type == 'PLACEHOLDER':
|
216
|
+
# 变量占位符 ${var}
|
217
|
+
expr_node = Node('PlaceholderRef', value=p[1])
|
218
|
+
else:
|
219
|
+
# 其他类型,保持原来的行为
|
220
|
+
expr_node = Node('Expression', value=p[1])
|
221
|
+
|
222
|
+
if expr_line is not None:
|
223
|
+
expr_node.set_position(expr_line)
|
224
|
+
p[0] = expr_node
|
202
225
|
|
203
226
|
|
204
227
|
def p_boolean_expr(p):
|
@@ -265,8 +288,29 @@ def p_keyword_call(p):
|
|
265
288
|
line_number = getattr(p.slice[1], 'lineno', None)
|
266
289
|
|
267
290
|
if len(p) == 6:
|
268
|
-
|
291
|
+
# 对于有参数的关键字调用,尝试获取更精确的行号
|
292
|
+
# 优先使用关键字名称的行号,其次是左括号的行号
|
293
|
+
keyword_line = getattr(p.slice[2], 'lineno', None)
|
294
|
+
if keyword_line is not None:
|
295
|
+
line_number = keyword_line
|
296
|
+
|
297
|
+
keyword_node = Node('KeywordCall', [p[5]], p[2],
|
298
|
+
line_number=line_number)
|
299
|
+
|
300
|
+
# 为参数列表中的每个参数也设置行号信息(如果可用)
|
301
|
+
if p[5] and isinstance(p[5], list):
|
302
|
+
for param in p[5]:
|
303
|
+
if (hasattr(param, 'set_position') and
|
304
|
+
not hasattr(param, 'line_number')):
|
305
|
+
# 如果参数没有行号,使用关键字的行号作为默认值
|
306
|
+
param.set_position(line_number)
|
307
|
+
|
308
|
+
p[0] = keyword_node
|
269
309
|
else:
|
310
|
+
# 对于无参数的关键字调用,也优先使用关键字名称的行号
|
311
|
+
keyword_line = getattr(p.slice[2], 'lineno', None)
|
312
|
+
if keyword_line is not None:
|
313
|
+
line_number = keyword_line
|
270
314
|
p[0] = Node('KeywordCall', [[]], p[2], line_number=line_number)
|
271
315
|
|
272
316
|
|
@@ -286,7 +330,15 @@ def p_parameter_items(p):
|
|
286
330
|
|
287
331
|
def p_parameter_item(p):
|
288
332
|
'''parameter_item : ID COLON expression'''
|
289
|
-
|
333
|
+
# 获取参数名的行号
|
334
|
+
param_line = getattr(p.slice[1], 'lineno', None)
|
335
|
+
param_node = Node('ParameterItem', value=p[1], children=[p[3]])
|
336
|
+
|
337
|
+
# 设置参数节点的行号
|
338
|
+
if param_line is not None:
|
339
|
+
param_node.set_position(param_line)
|
340
|
+
|
341
|
+
p[0] = param_node
|
290
342
|
|
291
343
|
|
292
344
|
def p_teardown(p):
|
@@ -1,5 +1,5 @@
|
|
1
|
-
pytest_dsl/__init__.py,sha256=
|
2
|
-
pytest_dsl/cli.py,sha256=
|
1
|
+
pytest_dsl/__init__.py,sha256=QAn8612I9Fn7SnnuaU34ZiAImZ2sHnuVaLuHi3S_3p4,5254
|
2
|
+
pytest_dsl/cli.py,sha256=bH2z5-Onqpir1ymB-DB-tu-fuI1nWHcwVo_3ve9Hgco,12845
|
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
|
@@ -9,7 +9,7 @@ pytest_dsl/core/auto_decorator.py,sha256=9Mga-GB4AzV5nkB6zpfaq8IuHa0KOH8LlFvnWyH
|
|
9
9
|
pytest_dsl/core/auto_directory.py,sha256=egyTnVxtGs4P75EIivRauLRPJfN9aZpoGVvp_Ma72AM,2714
|
10
10
|
pytest_dsl/core/context.py,sha256=fXpVQon666Lz_PCexjkWMBBr-Xcd1SkDMp2vHar6eIs,664
|
11
11
|
pytest_dsl/core/custom_keyword_manager.py,sha256=F9aSbth4x4-5nHb0N5uG04CpgwGnQv4RDGeRKR2WuIk,16001
|
12
|
-
pytest_dsl/core/dsl_executor.py,sha256=
|
12
|
+
pytest_dsl/core/dsl_executor.py,sha256=G3Ad97REt1jWwRvp7LS2Nq7zy3S2ZtYKlJeAJANDstI,60200
|
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
15
|
pytest_dsl/core/global_context.py,sha256=NcEcS2V61MT70tgAsGsFWQq0P3mKjtHQr1rgT3yTcyY,3535
|
@@ -21,8 +21,9 @@ pytest_dsl/core/http_client.py,sha256=hdx8gI4JCmq1-96pbiKeyKzSQUzPAi08cRNmljiPQm
|
|
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/
|
25
|
-
pytest_dsl/core/
|
24
|
+
pytest_dsl/core/keyword_utils.py,sha256=1zIKzbA8Lhifc97skzN4oJV-2Cljzf9aVSutwjU7LaA,19847
|
25
|
+
pytest_dsl/core/lexer.py,sha256=o_EJIadfhgyCImI73Y9ybqlBE9AisgA6nOhxpXNlaMw,4648
|
26
|
+
pytest_dsl/core/parser.py,sha256=SvTQ4jgMSe3MITSu9PftraElPAzVaBbNPHMEk1H_lFY,16597
|
26
27
|
pytest_dsl/core/parsetab.py,sha256=o4XbFKwpsi3fYmfI_F6u5NSM61Qp6gTx-Sfh1jDINxI,31767
|
27
28
|
pytest_dsl/core/plugin_discovery.py,sha256=3pt3EXJ7EPF0rkUlyDZMVHkIiTy2vicdIIQJkrHXZjY,8305
|
28
29
|
pytest_dsl/core/utils.py,sha256=q0AMdw5HO33JvlA3UJeQ7IXh1Z_8K1QlwiM1_yiITrU,5350
|
@@ -72,9 +73,9 @@ pytest_dsl/remote/keyword_client.py,sha256=BL80MOaLroUi0v-9sLtkJ55g1R0Iw9SE1k11I
|
|
72
73
|
pytest_dsl/remote/keyword_server.py,sha256=vGIE3Bhh461xX_u1U-Cf5nrWL2GQFYdtQdcMWfFIYgE,22320
|
73
74
|
pytest_dsl/remote/variable_bridge.py,sha256=dv-d3Gq9ttvvrXM1fdlLtoSOPB6vRp0_GBOwX4wvcy8,7121
|
74
75
|
pytest_dsl/templates/keywords_report.html,sha256=7x84iq6hi08nf1iQ95jZ3izcAUPx6JFm0_8xS85CYws,31241
|
75
|
-
pytest_dsl-0.15.
|
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.
|
76
|
+
pytest_dsl-0.15.2.dist-info/licenses/LICENSE,sha256=Rguy8cb9sYhK6cmrBdXvwh94rKVDh2tVZEWptsHIsVM,1071
|
77
|
+
pytest_dsl-0.15.2.dist-info/METADATA,sha256=vfUUteu2RO84-TI0j0TngY18o_L1w1VTa2v94eX_XZc,29655
|
78
|
+
pytest_dsl-0.15.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
79
|
+
pytest_dsl-0.15.2.dist-info/entry_points.txt,sha256=PLOBbH02OGY1XR1JDKIZB1Em87loUvbgMRWaag-5FhY,204
|
80
|
+
pytest_dsl-0.15.2.dist-info/top_level.txt,sha256=4CrSx4uNqxj7NvK6k1y2JZrSrJSzi-UvPZdqpUhumWM,11
|
81
|
+
pytest_dsl-0.15.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|