From b25c3334cc3452721b263beccd894b95da5dc8ad Mon Sep 17 00:00:00 2001 From: hrou0003 <54772688+hrou0003@users.noreply.github.com> Date: Mon, 14 Apr 2025 03:57:05 +1000 Subject: [PATCH] Detect decorated pytest methods as runnable (#28652) Closes #28096 Release Notes: - Fixed decorated pytest methods not being picked up as runnable --- crates/languages/src/python/runnables.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/crates/languages/src/python/runnables.scm b/crates/languages/src/python/runnables.scm index 3b32556707..84a024de94 100644 --- a/crates/languages/src/python/runnables.scm +++ b/crates/languages/src/python/runnables.scm @@ -83,6 +83,26 @@ ) ) +; decorated pytest class methods +( + (module + (class_definition + name: (identifier) @_pytest_class_name + (#match? @_pytest_class_name "^Test") + body: (block + (decorated_definition + (decorator)+ @_decorator + definition: (function_definition + name: (identifier) @run @_pytest_method_name + (#match? @_pytest_method_name "^test_") + ) + ) + ) @_python-pytest-method + (#set! tag python-pytest-method) + ) + ) +) + ; module main method ( (module