PR feedback: Make shouldfail and shouldstop properties, prevent True -> False transition
This commit is contained in:
parent
c1adee097b
commit
75e9f3b19d
|
@ -548,8 +548,8 @@ class Session(nodes.Collector):
|
|||
)
|
||||
self.testsfailed = 0
|
||||
self.testscollected = 0
|
||||
self.shouldstop: Union[bool, str] = False
|
||||
self.shouldfail: Union[bool, str] = False
|
||||
self._shouldstop: Union[bool, str] = False
|
||||
self._shouldfail: Union[bool, str] = False
|
||||
self.trace = config.trace.root.get("collection")
|
||||
self._initialpaths: FrozenSet[Path] = frozenset()
|
||||
self._initialpaths_with_parents: FrozenSet[Path] = frozenset()
|
||||
|
@ -576,6 +576,28 @@ class Session(nodes.Collector):
|
|||
self.testscollected,
|
||||
)
|
||||
|
||||
@property
|
||||
def shouldstop(self) -> Union[bool, str]:
|
||||
return self._shouldstop
|
||||
|
||||
@shouldstop.setter
|
||||
def shouldstop(self, value: Union[bool, str]) -> None:
|
||||
"""Prevent plugins from setting this to False once it has been set."""
|
||||
if value is False and self._shouldstop:
|
||||
return
|
||||
self._shouldstop = value
|
||||
|
||||
@property
|
||||
def shouldfail(self) -> Union[bool, str]:
|
||||
return self._shouldfail
|
||||
|
||||
@shouldfail.setter
|
||||
def shouldfail(self, value: Union[bool, str]) -> None:
|
||||
"""Prevent plugins from setting this to False once it has been set."""
|
||||
if value is False and self._shouldfail:
|
||||
return
|
||||
self._shouldfail = value
|
||||
|
||||
@property
|
||||
def startpath(self) -> Path:
|
||||
"""The path from which pytest was invoked.
|
||||
|
|
Loading…
Reference in New Issue