Skip to main content

pytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout)

Project description

pytest-print

Allows to print extra content onto the PyTest reporting. This can be used for example to report sub-steps for long running tests, or to print debug information in your tests when you cannot debug the code.

Latest version on PyPI Supported Python versions Azure Pipelines build status Documentation status Code style: black

install

pip install pytest-print

The plugin provides ability to print information during the tests runs.

use cases

sub-step reporting

For tests that are long running this can provide a feedback ot the end-user that what is just happening in the background.

def test_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 ===========================

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_print-0.1.1-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pytest_print-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: pytest_print-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.1

File hashes

Hashes for pytest_print-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 07adde5739566ace129b8b51777e77b00f7fcedd9b926d3034dd2f8670fff95d
MD5 26a53f95bba8971370141d8d59248a4b
BLAKE2b-256 2a9f2b91d7af1b017476a7a76068ba33859b81088b167be55671c1f4c8c04668

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page