python: Fix decorated test detection (#22327)

Follow-up to #22325, where I missed a couple points in the review that
were actually quite relevant.

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-12-21 14:11:52 +01:00 committed by GitHub
parent 7184b15f48
commit fac5118f10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,7 +36,7 @@
(function_definition
name: (identifier) @run @_pytest_method_name
(#match? @_pytest_method_name "^test_")
) @python-pytest-method
) @_python-pytest-method
)
(#set! tag python-pytest-method)
)
@ -45,12 +45,12 @@
(
(module
(decorated_definition
(decorator)+ @decorator
(decorator)+ @_decorator
definition: (function_definition
name: (identifier) @run @_pytest_decorated_method_name
(#match? @_pytest_decorated_method_name "^test_")
name: (identifier) @run @_pytest_method_name
(#match? @_pytest_method_name "^test_")
)
) @python-pytest-method
) @_python-pytest-method
)
(#set! tag python-pytest-method)
)
@ -76,7 +76,7 @@
(function_definition
name: (identifier) @run @_pytest_method_name
(#match? @_pytest_method_name "^test")
) @python-pytest-method
) @_python-pytest-method
(#set! tag python-pytest-method)
)
)