Explicitly fail an executing test with the given message. :param reason: The message to show the user as reason for the failure. :param pytrace: If False, msg represents the full failure information and no python traceback will be reported. :param msg:
(
reason: str = "", pytrace: bool = True, msg: Optional[str] = None
)
| 177 | |
| 178 | @_with_exception(Failed) |
| 179 | def fail( |
| 180 | reason: str = "", pytrace: bool = True, msg: Optional[str] = None |
| 181 | ) -> "NoReturn": |
| 182 | """Explicitly fail an executing test with the given message. |
| 183 | |
| 184 | :param reason: |
| 185 | The message to show the user as reason for the failure. |
| 186 | |
| 187 | :param pytrace: |
| 188 | If False, msg represents the full failure information and no |
| 189 | python traceback will be reported. |
| 190 | |
| 191 | :param msg: |
| 192 | Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead. |
| 193 | """ |
| 194 | __tracebackhide__ = True |
| 195 | reason = _resolve_msg_to_reason("fail", reason, msg) |
| 196 | raise Failed(msg=reason, pytrace=pytrace) |
| 197 | |
| 198 | |
| 199 | def _resolve_msg_to_reason( |