A goody-bag of nifty plugins for pytest

October 24, 2024 ยท View on GitHub

OSBuildCoverage
LinuxCircleCI (Linux)Coverage Status
WindowsCircleCI (Linux)
PluginDescriptionSupported OS
pytest-server-fixturesExtensible server-running framework with a suite of well-known databases and webservices includedLinux
pytest-shutilUnix shell and environment management toolsLinux
pytest-profilingProfiling plugin with tabular heat graph output and gprof support for C-ExtensionsLinux
pytest-devpi-serverDevPI server fixtureLinux
pytest-pyramid-serverPyramid server fixtureLinux
pytest-webdriverSelenium webdriver fixtureLinux
pytest-virtualenvVirtualenv fixtureLinux Windows
pytest-qt-appPyQT application fixtureLinux
pytest-listenerTCP Listener/Reciever for testing remote systemsLinux Windows
pytest-gitGit repository fixtureLinux Windows
pytest-svnSVN repository fixtureLinux
pytest-fixture-configConfiguration tools for Py.test fixturesLinux Windows
pytest-verbose-parametrizeMakes py.test's parametrize output a little more verboseLinux

Developing these plugins

All of these plugins share setup code and configuration so there is a top-level Makefile to automate process of setting them up for test and development.

Pre-requisites

You have python installed on your path, preferably using a virtualenv

Makefile targets

To install all dependencies and set up all of the packages for development simply run:

    make develop

To install all the packages as wheel distributions:

    make install

To run all the tests:

    make test

Vagrant

Some of the plugins have complex dependencies, particularly pytest-server-fixtures. To make it easier to develop, there is a Vagrantfile which will setup a virtual machine with all the dependencies installed to run the tests.

To set up the environment in Vagrant (requires virtualbox) and run the tests:

    $ vagrant up
    $ vagrant ssh

    # ..... inside vagrant ....
    . venv/bin/activate
    cd src
    make develop
    make test

foreach.sh

To run a command in each of the package directories, use the foreach.sh script. This example will build all the wheel distributions:

    ./foreach.sh python setup.py bdist_wheel

Only-Changed mode

To run a command only on packages that have changed since the last tagged release, use --changed. This example will only upload packages that need releasing:

    ./foreach.sh python setup.py bdist_wheel upload

Quiet mode

To run a command with no extra output other than from what you run, use --quiet

    ./foreach.sh --quiet grep PY3