MCPcopy Create free account
hub / github.com/pytest-dev/pytest / addfinalizer

Method addfinalizer

src/_pytest/runner.py:503–511  ·  view source on GitHub ↗

Attach a finalizer to the given node. The node must be currently active in the stack.

(self, finalizer: Callable[[], object], node: Node)

Source from the content-addressed store, hash-verified

501 raise exc
502
503 def addfinalizer(self, finalizer: Callable[[], object], node: Node) -> None:
504 """Attach a finalizer to the given node.
505
506 The node must be currently active in the stack.
507 """
508 assert node and not isinstance(node, tuple)
509 assert callable(finalizer)
510 assert node in self.stack, (node, self.stack)
511 self.stack[node][0].append(finalizer)
512
513 def teardown_exact(self, nextitem: Optional[Item]) -> None:
514 """Teardown the current stack up until reaching nodes that nextitem

Callers

nothing calls this directly

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected