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