Skip to content

Commit

Permalink
Fix coverage test failure
Browse files Browse the repository at this point in the history
Was failing with

    tests/test_ast.py:71: in <module>
        @parametrize_nodes()
    tests/test_ast.py:60: in parametrize_nodes
        nodes = [_instantiate_node(node_type) for node_type in node_types]
    tests/test_ast.py:55: in _instantiate_node
        return node_type(*([""] * len(node_type._fields)))
    E   TypeError: NodeList.__init__() missing 1 required positional argument: 'body'

coverage package adds a coverage.parser.NodeList subclass. See
nedbat/coveragepy@0accb68
  • Loading branch information
ericbn committed May 10, 2024
1 parent d257d06 commit 51296f0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
def _nodes_types(
node_type: type[ast.AST] = ast.AST,
) -> Iterable[type[ast.AST]]:
# coverage package adds a coverage.parser.NodeList subclass
if node_type.__module__ != "ast":
return

# Skip deprecated AST nodes.
if issubclass(node_type, _deprecated_node_types):
return
Expand Down

0 comments on commit 51296f0

Please sign in to comment.