A fork of 'expecter' with better support for pytest.
Project description
This is a fork of garybernhardt/expecter that hides the internal stack trace for pytest.
Overview
This lets you write tests (using ropez/pytest-describe) like this:
from expecter import expect
def describe_foobar():
def it_can_pass():
expect(2 + 3) == 5
def it_can_fail():
expect(2 + 3) == 6
and instead of getting output like this:
=================================== FAILURES ===================================
_________________________ describe_foobar.it_can_fail __________________________
def it_can_fail():
> expect(2 + 3) == 6
test_expecter.py:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = expect(3), other = 4
def __eq__(self, other):
msg = 'Expected %s but got %s' % (repr(other), repr(self._actual))
if (isinstance(other, basestring) and
isinstance(self._actual, basestring)):
msg += normalized_diff(other, self._actual)
elif len(repr(self._actual)) > 74:
msg += normalized_diff(pprint.pformat(other),
pprint.pformat(self._actual))
> assert self._actual == other, msg
E AssertionError: Expected 6 but got 5
env/lib/python3.5/site-packages/expecter.py:57: AssertionError
====================== 1 failed, 1 passed in 2.67 seconds ======================
getting output like this:
=================================== FAILURES ===================================
_________________________ describe_foobar.it_can_fail __________________________
def it_can_fail():
> expect(2 + 3) == 6
E AssertionError: Expected 6 but got 5
test_expecter.py:14: AssertionError
====================== 1 failed, 1 passed in 2.67 seconds ======================
Installation
pip install pytest-expecter
Versioning
This plugin’s version number will follow expecter:
M.N.P-F
where:
M.N.P is the version of expecter included in the plugin
F is incremented on each release of the plugin for that version
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for pytest-expecter-0.2.2.post1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1868e755f3a1d21febeafe0a73f073c503f77205c79be605f43680d3771e12c2 |
|
MD5 | 8b6e6d2e138c9ac172e60a25a894a316 |
|
BLAKE2b-256 | ca68888650f2a63fd5a76bdf0b357d9d60db715a5df4126663f720fa816e025c |