Metadata-Version: 2.1
Name: pytest-print
Version: 0.1.2
Summary: pytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout)
Home-page: https://pytest-print.readthedocs.io/en/latest/
Author: Bernat Gabor
Maintainer: Bernat Gabor
Maintainer-email: gaborjbernat@gmail.com
License: UNKNOWN
Project-URL: Source, https://github.com/pytest-dev/pytest-print
Project-URL: Tracker, https://github.com/pytest-dev/pytest-print/issues
Keywords: pytest,print,debug
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Framework :: Pytest
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
Requires-Dist: pytest (<5,>=3.0.0)
Requires-Dist: six (<2,>=1.10.0)
Requires-Dist: typing (<4,>=3.6.4) ; python_version < "3.5"
Provides-Extra: docs
Requires-Dist: Sphinx (<2,>=1.7.2) ; extra == 'docs'
Provides-Extra: test
Requires-Dist: pytest (<5,>=3.5.0) ; extra == 'test'
Requires-Dist: coverage (<5,>=4.5.2) ; extra == 'test'

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.

.. image:: https://badge.fury.io/py/pytest_print.svg
  :target: https://badge.fury.io/py/pytest_print
  :alt: Latest version on PyPI
.. image:: https://img.shields.io/pypi/pyversions/pytest_print.svg
  :target: https://pypi.org/project/pytest_print/
  :alt: Supported Python versions
.. image:: https://dev.azure.com/pytestdev/pytest_print/_apis/build/status/pytest-dev.pytest-print
  :target: https://dev.azure.com/pytestdev/pytest_print/_build/latest?definitionId=1
  :alt: Azure Pipelines build status
.. image:: https://readthedocs.org/projects/pytest_print/badge/?version=latest&style=flat-square
  :target: https://pytest_print.readthedocs.io/en/latest/?badge=latest
  :alt: Documentation status
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
  :target: https://github.com/ambv/black
  :alt: Code style: black


install
=======

.. code-block:: sh

   pip install pytest-print

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

flags
=====
* ``--print`` by default the module activates print when pytest verbosity is greater than zero, this allows to bypass
  this and force print irrespective of the verbosity
* ``--print-relative-time`` will print the relative time since the start of the test (display how long it takes to reach
  prints)

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.


.. code-block:: python

   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()

.. code-block:: sh

    $ 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 ===========================


