(
self,
argname: str,
invoking_scope: Scope,
requested_scope: Scope,
)
| 701 | subrequest.node.addfinalizer(lambda: fixturedef.finish(request=subrequest)) |
| 702 | |
| 703 | def _check_scope( |
| 704 | self, |
| 705 | argname: str, |
| 706 | invoking_scope: Scope, |
| 707 | requested_scope: Scope, |
| 708 | ) -> None: |
| 709 | if argname == "request": |
| 710 | return |
| 711 | if invoking_scope > requested_scope: |
| 712 | # Try to report something helpful. |
| 713 | text = "\n".join(self._factorytraceback()) |
| 714 | fail( |
| 715 | f"ScopeMismatch: You tried to access the {requested_scope.value} scoped " |
| 716 | f"fixture {argname} with a {invoking_scope.value} scoped request object, " |
| 717 | f"involved factories:\n{text}", |
| 718 | pytrace=False, |
| 719 | ) |
| 720 | |
| 721 | def _factorytraceback(self) -> List[str]: |
| 722 | lines = [] |
no test coverage detected