Metadata-Version: 2.1
Name: pytest-print
Version: 0.2.0
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: MIT
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: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Utilities
Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7
Description-Content-Type: text/x-rst
Requires-Dist: pytest (>=3.0.0)
Provides-Extra: docs
Requires-Dist: Sphinx (>=3) ; extra == 'docs'
Provides-Extra: test
Requires-Dist: coverage (>=5) ; extra == 'test'
Requires-Dist: pytest (>=4) ; 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.

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


