in testslide/runner.py [0:0]
def _run_example(self, example: Example) -> None:
if example.focus and self.fail_if_focused:
raise AssertionError(
"Focused example not allowed with --fail-if-focused"
". Please remove the focus to allow the test to run."
)
if self.quiet:
stdout = io.StringIO()
stderr = io.StringIO()
example_exception = None
with redirect_stdout(stdout), redirect_stderr(stderr):
try:
_ExampleRunner(example, self.formatter).run()
except BaseException as ex:
example_exception = ex
if example_exception:
if not isinstance(example_exception, Skip):
if stdout.getvalue():
print("stdout:\n{}".format(stdout.getvalue()))
if stderr.getvalue():
print("stderr:\n{}".format(stderr.getvalue()))
raise example_exception
else:
_ExampleRunner(example, self.formatter).run()