mbednarski / pytest-assume

A pytest plugin that allows multiple failures per test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pytest-assume

Build Status

A pytest plugin that allows multiple failures per test

Forked from Brian Okken's work with 'pytest-expect', there are a few changes/improvements:

  1. Showlocals support
  2. Global usage support (Does not need a fixture)
  3. Output tweaking

Installation

pip install git+https://github.com/astraw38/pytest-assume.git
or
pip install pytest-assume

Sample Usage:

import pytest
    
@pytest.mark.parametrize(('x', 'y'), [(1, 1), (1, 0), (0, 1)])
def test_simple_assume(x, y):
    pytest.assume(x == y)
    pytest.assume(True)
    pytest.assume(False)
======================================== FAILURES =========================================
_________________________________ test_simple_assume[1-1] _________________________________
>    pytest.assume(False)
test_assume.py:7

y          = 1
x          = 1
----------------------------------------
Failed Assumptions:1
_________________________________ test_simple_assume[1-0] _________________________________
>    pytest.assume(x == y)
test_assume.py:5

y          = 0
x          = 1
>    pytest.assume(False)
test_assume.py:7

y          = 0
x          = 1
----------------------------------------
Failed Assumptions:2
_________________________________ test_simple_assume[0-1] _________________________________
>    pytest.assume(x == y)
test_assume.py:5

y          = 1
x          = 0
>    pytest.assume(False)
test_assume.py:7

y          = 1
x          = 0
----------------------------------------
Failed Assumptions:2
================================ 3 failed in 0.02 seconds =================================

About

A pytest plugin that allows multiple failures per test

License:MIT License


Languages

Language:Python 100.0%