Skip to content

Commit 3c8096a

Browse files
author
David Fritzsche
committed
Fix some type hints to support async function definitions
1 parent fc9bab9 commit 3c8096a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/pytest_mypy_testing/parser.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,17 @@ def _add_end_lineno_if_missing(tree, line_count: int):
150150
setattr(prev_node, "end_lineno", line_count) # noqa: B010
151151

152152

153-
def _find_marks(func_node: ast.FunctionDef) -> Set[str]:
153+
def _find_marks(func_node: Union[ast.FunctionDef, ast.AsyncFunctionDef]) -> Set[str]:
154154
return {
155155
name.split(".", 2)[2]
156156
for name, _ in _iter_func_decorators(func_node)
157157
if name.startswith("pytest.mark.")
158158
}
159159

160160

161-
def _iter_func_decorators(func_node: ast.FunctionDef) -> Iterator[Tuple[str, ast.AST]]:
161+
def _iter_func_decorators(
162+
func_node: Union[ast.FunctionDef, ast.AsyncFunctionDef]
163+
) -> Iterator[Tuple[str, ast.AST]]:
162164
def dotted(*nodes):
163165
return ".".join(_get_node_name(node) for node in reversed(nodes))
164166

0 commit comments

Comments
 (0)