GithubHelp home page GithubHelp logo

isabella232 / pytest-print Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pytest-dev/pytest-print

0.0 0.0 0.0 94 KB

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://github.com/pytest-dev/pytest-print#pytest-print

License: MIT License

Python 100.00%

pytest-print's Introduction

pytest-print

PyPI PyPI - Implementation PyPI - Python Version PyPI - Downloads PyPI - License check Code style: 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

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.

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

pytest-print's People

Contributors

gaborbernat avatar pre-commit-ci[bot] avatar shashanksingh28 avatar vtbassmatt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.