Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: pytest decorated class methods fails (#4498)

Dylan Madisetticd14e6bb3961
diff --git a/marimo/_ast/pytest.py b/marimo/_ast/pytest.py
index 000b094a5b..2a5ec8b57a 100644
--- a/marimo/_ast/pytest.py
+++ b/marimo/_ast/pytest.py
@@ -49,7 +49,7 @@ def build_stub_fn(
args = {arg.arg: arg for arg in func_body.args.args}
if allowed is None:
- allowed = [arg for arg in args.keys() if arg != "self"]
+ allowed = [arg for arg in args.keys()]
name = func_body.name
# Typing checks for mypy
diff --git a/tests/_ast/test_pytest_toplevel.py b/tests/_ast/test_pytest_toplevel.py
index 58bf78979f..61de6131a9 100644
--- a/tests/_ast/test_pytest_toplevel.py
+++ b/tests/_ast/test_pytest_toplevel.py
@@ -38,6 +38,15 @@ class TestClassWorks:
def test_sanity(self):
assert True
+ @pytest.mark.parametrize(("a", "b", "c"), [(1, 1, 2), (1, 2, 3)])
+ def test_decorated(self, a, b, c):
+ assert add(a, b) == c
+
+ @staticmethod
+ @pytest.mark.parametrize(("a", "b", "c"), [(1, 1, 2), (1, 2, 3)])
+ def test_decorated_static(a, b, c) -> None:
+ assert add(a, b) == c
+
if __name__ == "__main__":
app.run()