打印添加了可以用来向用户打印消息的打印机固定器(直接指向未经验证的运行程序)。
pytest-print的Python项目详细描述
安装
pip install pytest-print
插件提供了在测试运行期间打印信息的能力。
标志
- --print默认情况下,当pytest verbosity大于零时,模块激活print,这允许绕过 这将强制打印,而不考虑详细程度
- --print-relative-time将打印自测试开始以来的相对时间(显示到达所需的时间 打印)
打印添加了可以用来向用户打印消息的打印机固定器(直接指向未经验证的运行程序)。
pip install pytest-print
插件提供了在测试运行期间打印信息的能力。
对于长期运行的测试,这可以向最终用户提供一个反馈,即 背景。
deftest_server_parallel_requests(printer,tmpdir):printer("create virtual environment into {}".format(tmpdir))create_virtual_environment(tmpdir)printer("start server from virtual env")start_server(tmpdir)printer("do the parallel request test")parallel_requests()
$ py.test --vv =============================test session starts============================== platform linux -- Python 3.6.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0 collecting ... collected 1 item test_printer_progress.py::test_server_parallel_requests create virtual environment start server from virtual env do the parallel request test PASSED [100%]===========================1 passed in 0.02 seconds===========================