pyppin.testing.trace_on_failure

[View Source]

A decorator that prints a stack trace for all threads if a function, method, or test case fails.

Functions

trace_on_failure(target, *[, output, limit, ...])

Decorator which can be applied to functions, methods, and TestCases.

pyppin.testing.trace_on_failure.trace_on_failure(target: Union[Callable, Type[TestCase]], *, output: Optional[TextIOBase] = None, limit: Optional[int] = None, daemons: bool = True, group: bool = True, exclude_assertion_failures: bool = True) Callable[source]

Decorator which can be applied to functions, methods, and TestCases. If any exception happens while executing the item, dump a full stack trace (of all active threads) to output.

Parameters
  • output – Where to write the output; defaults to stderr.

  • limit – As the argument to all_stacks.

  • daemons – Whether to include daemon threads.

  • group – If True, group together threads with identical traces.

  • exclude_assertion_failures – If this decorator is applied to a TestCase, then it will only print stack traces on exceptions, not on assertion failures from within the test.