File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -808,16 +808,7 @@ def formatrepr(self) -> FixtureLookupErrorRepr:
808808 stack = [self .request ._pyfuncitem .obj ]
809809 stack .extend (map (lambda x : x .func , self .fixturestack ))
810810 msg = self .msg
811- # This function currently makes an assumption that a non-None msg means we
812- # have a non-empty `self.fixturestack`. This is currently true, but if
813- # somebody at some point want to extend the use of FixtureLookupError to
814- # new cases it might break.
815- # Add the assert to make it clearer to developer that this will fail, otherwise
816- # it crashes because `fspath` does not get set due to `stack` being empty.
817- assert self .msg is None or self .fixturestack , (
818- "formatrepr assumptions broken, rewrite it to handle it"
819- )
820- if msg is not None :
811+ if msg is not None and len (stack ) > 1 :
821812 # The last fixture raise an error, let's present
822813 # it at the requesting side.
823814 stack = stack [:- 1 ]
You can’t perform that action at this time.
0 commit comments