Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Detect decorated pytest methods as runnable (#28652)

hrou0003b25c3334cc34
diff --git a/crates/languages/src/python/runnables.scm b/crates/languages/src/python/runnables.scm
index 3b325567075..84a024de947 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