(
self,
requested_fixturedef: FixtureDef[object],
requested_scope: Scope,
)
| 864 | return self._node |
| 865 | |
| 866 | def _check_scope( |
| 867 | self, |
| 868 | requested_fixturedef: FixtureDef[object], |
| 869 | requested_scope: Scope, |
| 870 | ) -> None: |
| 871 | if self._scope > requested_scope: |
| 872 | # Try to report something helpful. |
| 873 | argname = requested_fixturedef.argname |
| 874 | fixture_stack = "\n".join( |
| 875 | self._format_fixturedef_line(fixturedef) |
| 876 | for fixturedef in self._get_fixturestack() |
| 877 | ) |
| 878 | requested_fixture = self._format_fixturedef_line(requested_fixturedef) |
| 879 | fail( |
| 880 | f"ScopeMismatch: You tried to access the {requested_scope.value} scoped " |
| 881 | f"fixture {argname} with a {self._scope.value} scoped request object. " |
| 882 | f"Requesting fixture stack:\n{fixture_stack}\n" |
| 883 | f"Requested fixture:\n{requested_fixture}", |
| 884 | pytrace=False, |
| 885 | ) |
| 886 | |
| 887 | def _format_fixturedef_line(self, fixturedef: FixtureDef[object]) -> str: |
| 888 | factory = fixturedef.func |
nothing calls this directly
no test coverage detected