Pytest extensions

Pytest extensions

Name

Description

pytest-check

Allow multiple fails per test (compares a lot of attributes, not fails on the first Exception)

pytest-cov

Run coverage with pytest together (before you could run coverage from pytest or vice-versa)

pytest-flakes

Run flake8 against your code during pytest runs (test code + source code)

pytest-freezegun

Fixture: change time and data during test execution to make time-based test pass (instead of mock)

pytest-instafail

Shows test failures instantly (during execution)

pytest-metadata

Add additional info to test report (e.g. environment, OS, version, …)

pytest-picked

Run tests from uncommited test files in a local git repository only (changed files)

pytest-randomly

Tests are reordered randomly for execution; randoms test data

pytest-spec

Define what to show during test execution ("nice little one")

pytest-splinter

Wrapper for Selenium on pytest

pytest-stress

Runs test in a loop for a certain time period

pytest-sugar

Replaces ‘.’ with green check marks for passing tests

pytest-timeout

Suited for longer running test: kills test if it doesn’t finish in time -> decorate tests individually

pytest-xdist

Run tests in parallel (for independent tests which don’t share resources, run on different machine, loop-on-fail (rerun failinig test while you’re fixing it, afterwards retest the whole suite

tox

Run Python tests in multiple environments