(
node: nodes.Node, scope: Scope
)
| 130 | |
| 131 | |
| 132 | def get_scope_node( |
| 133 | node: nodes.Node, scope: Scope |
| 134 | ) -> Optional[Union[nodes.Item, nodes.Collector]]: |
| 135 | import _pytest.python |
| 136 | |
| 137 | if scope is Scope.Function: |
| 138 | return node.getparent(nodes.Item) |
| 139 | elif scope is Scope.Class: |
| 140 | return node.getparent(_pytest.python.Class) |
| 141 | elif scope is Scope.Module: |
| 142 | return node.getparent(_pytest.python.Module) |
| 143 | elif scope is Scope.Package: |
| 144 | return node.getparent(_pytest.python.Package) |
| 145 | elif scope is Scope.Session: |
| 146 | return node.getparent(_pytest.main.Session) |
| 147 | else: |
| 148 | assert_never(scope) |
| 149 | |
| 150 | |
| 151 | # Used for storing artificial fixturedefs for direct parametrization. |
no test coverage detected