pytest-plus

raw JSON →
0.8.1 verified Fri May 01 auth: no python

A pytest plugin that extends pytest functionality with enhanced assertions, test ordering, and fixtures. Current version is 0.8.1, with a monthly release cadence. Supports Python >=3.10.

pip install pytest-plus
error ImportError: cannot import name 'plus' from 'pytest_plus'
cause Older version of pytest-plus installed (pre-0.8.0) where the helper was named 'assert_that'.
fix
Upgrade pytest-plus to >=0.8.0: pip install --upgrade pytest-plus
error TypeError: plus() got an unexpected keyword argument 'expected'
cause Using old API from pre-0.8.0 where plus (formerly assert_that) accepted keyword arguments like 'expected'.
fix
Use the new API: plus(actual, expected) positional arguments.
gotcha pytest-plus overrides default pytest behavior for fixture ordering. Existing tests may fail if they depend on fixture execution order.
fix Use 'pytest --no-header' or disable pytest-plus specific ordering with '-p no:plus'
breaking In version 0.8.0, the 'assert_that' helper was renamed to 'plus' and its signature changed. Old code using 'assert_that' will break.
fix Replace 'from pytest_plus import assert_that' with 'from pytest_plus import plus' and update calls accordingly.

Basic usage of the plus helper from pytest-plus. Run with: pytest

# content of test_example.py
from pytest_plus import plus

def test_addition():
    result = plus(2, 3)
    assert result == 5, f"Expected 5, got {result}"