pytest-print


Namepytest-print JSON
Version 1.0.0 PyPI version JSON
download
home_page
Summarypytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout)
upload_time2023-08-25 15:30:59
maintainer
docs_urlNone
author
requires_python>=3.8
license Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords env pytest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pytest-print

[![PyPI](https://img.shields.io/pypi/v/pytest-print?style=flat-square)](https://pypi.org/project/pytest-print)
[![PyPI - Implementation](https://img.shields.io/pypi/implementation/pytest-print?style=flat-square)](https://pypi.org/project/pytest-print)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-print?style=flat-square)](https://pypi.org/project/pytest-print)
[![Downloads](https://static.pepy.tech/badge/pytest-print/month)](https://pepy.tech/project/pytest-print)
[![PyPI - License](https://img.shields.io/pypi/l/pytest-print?style=flat-square)](https://opensource.org/licenses/MIT)
[![check](https://github.com/pytest-dev/pytest-print/workflows/check/badge.svg)](https://github.com/pytest-dev/pytest-print/actions?query=workflow%3Acheck)
[![Code style:
black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)

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

```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 to the end-user that what is just happening in the
background.

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

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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pytest-print",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Bern\u00e1t G\u00e1bor <gaborjbernat@gmail.com>",
    "keywords": "env,pytest",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/83/c6/b8be6831ad51747df914be6cb647ae3005b4580bfa0af38268b4475ec783/pytest_print-1.0.0.tar.gz",
    "platform": null,
    "description": "# pytest-print\n\n[![PyPI](https://img.shields.io/pypi/v/pytest-print?style=flat-square)](https://pypi.org/project/pytest-print)\n[![PyPI - Implementation](https://img.shields.io/pypi/implementation/pytest-print?style=flat-square)](https://pypi.org/project/pytest-print)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-print?style=flat-square)](https://pypi.org/project/pytest-print)\n[![Downloads](https://static.pepy.tech/badge/pytest-print/month)](https://pepy.tech/project/pytest-print)\n[![PyPI - License](https://img.shields.io/pypi/l/pytest-print?style=flat-square)](https://opensource.org/licenses/MIT)\n[![check](https://github.com/pytest-dev/pytest-print/workflows/check/badge.svg)](https://github.com/pytest-dev/pytest-print/actions?query=workflow%3Acheck)\n[![Code style:\nblack](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)\n\nAllows to print extra content onto the PyTest reporting. This can be used for example to report sub-steps for long\nrunning tests, or to print debug information in your tests when you cannot debug the code.\n\n## install\n\n```sh\npip install pytest-print\n```\n\nThe plugin provides ability to print information during the tests runs.\n\n## flags\n\n- `--print` by default the module activates print when pytest verbosity is greater than zero, this allows to bypass this\n  and force print irrespective of the verbosity\n- `--print-relative-time` will print the relative time since the start of the test (display how long it takes to reach\n  prints)\n\n## use cases\n\n### sub-step reporting\n\nFor tests that are long running this can provide a feedback to the end-user that what is just happening in the\nbackground.\n\n```python\ndef test_server_parallel_requests(printer, tmpdir):\n    printer(\"create virtual environment into {}\".format(tmpdir))\n    create_virtual_environment(tmpdir)\n\n    printer(\"start server from virtual env\")\n    start_server(tmpdir)\n\n    printer(\"do the parallel request test\")\n    parallel_requests()\n```\n\n```bash\n$ py.test --vv\n============================= test session starts ==============================\nplatform linux -- Python 3.6.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0\ncollecting ... collected 1 item\n\ntest_printer_progress.py::test_server_parallel_requests\n    create virtual environment\n    start server from virtual env\n    do the parallel request test\nPASSED                                                                   [100%]\n\n=========================== 1 passed in 0.02 seconds ===========================\n```\n",
    "bugtrack_url": null,
    "license": " Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "pytest-print adds the printer fixture you can use to print messages to the user (directly to the pytest runner, not stdout)",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/pytest-dev/pytest-print",
        "Source": "https://github.com/pytest-dev/pytest-print",
        "Tracker": "https://github.com/pytest-dev/pytest-print/issues"
    },
    "split_keywords": [
        "env",
        "pytest"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a4084101c76d51f0e31181fa35f5dfe3a2075cc9ac5d32e00e3e4134b1f2ff5",
                "md5": "d5fb097afea75a033283c466473e11af",
                "sha256": "23484f42b906b87e31abd564761efffeb0348a6f83109fb857ee6e8e5df42b69"
            },
            "downloads": -1,
            "filename": "pytest_print-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d5fb097afea75a033283c466473e11af",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5432,
            "upload_time": "2023-08-25T15:30:58",
            "upload_time_iso_8601": "2023-08-25T15:30:58.472613Z",
            "url": "https://files.pythonhosted.org/packages/3a/40/84101c76d51f0e31181fa35f5dfe3a2075cc9ac5d32e00e3e4134b1f2ff5/pytest_print-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83c6b8be6831ad51747df914be6cb647ae3005b4580bfa0af38268b4475ec783",
                "md5": "8861fa373c3c975df0bbb11199adb841",
                "sha256": "1fcde9945fba462227a8959271369b10bb7a193be8452162707e63cd60875ca0"
            },
            "downloads": -1,
            "filename": "pytest_print-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8861fa373c3c975df0bbb11199adb841",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9565,
            "upload_time": "2023-08-25T15:30:59",
            "upload_time_iso_8601": "2023-08-25T15:30:59.655033Z",
            "url": "https://files.pythonhosted.org/packages/83/c6/b8be6831ad51747df914be6cb647ae3005b4580bfa0af38268b4475ec783/pytest_print-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-25 15:30:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pytest-dev",
    "github_project": "pytest-print",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pytest-print"
}
        
Elapsed time: 0.11026s