[pytest-dev] Using print statements in pytest's teardown_method()

holger krekel holger at merlinux.eu
Wed Apr 30 12:02:35 CEST 2014


On Mon, Apr 21, 2014 at 21:12 +0300, Alexander Petrovich wrote:
> Is there any way to get them actually printed? I use pytest to run my
> selenium tests and I got some test failure information printed in teardown,
> such as fail url, fail screenshot, user, etc. But I can't find any way to
> get them printed. Could you suggest something, please?

A teardown hook or a fixture finalizer is indeed not useful.
I can think only of adding a pytest_pyfunc_call hook to a
conftest.py file which wraps test execution and prints some
extra information which is then shown in the captured output
in the failure output.  Can try to post an example if you need
it but am a bit too busy to do it immediately.

best,
holger

> -- 
> With best regards,
> Petrovich Alexander
> QA Automation Engineer
> Smartweb Consulting

> _______________________________________________
> Pytest-dev mailing list
> Pytest-dev at python.org
> https://mail.python.org/mailman/listinfo/pytest-dev



More information about the Pytest-dev mailing list