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_foobar.py:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = expect(5), other = 6
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_foobar.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:
X.Y.Z.postN
where:
X.Y.Z is the version of expecter included in the plugin
N 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
Built Distribution
File details
Details for the file pytest-expecter-0.2.2.post7.tar.gz
.
File metadata
- Download URL: pytest-expecter-0.2.2.post7.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f73ce7f86cf4feb36df002baa37767765648da29896c3d5e442ce0f14d9ccdfe |
|
MD5 | e5a5be1bc6741339f5b58c22c5ed99e8 |
|
BLAKE2b-256 | 6da0cf17a9b3f5ed17e45afb7b68353399b55c7816395037d8062d0591dbf131 |
File details
Details for the file pytest_expecter-0.2.2.post7-py2-none-any.whl
.
File metadata
- Download URL: pytest_expecter-0.2.2.post7-py2-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbcf02b47d5963203f0df1ecf9818885ff129f2dc59900aa80e05092ddbf6972 |
|
MD5 | adb727b190ed76e5582459e55cee2469 |
|
BLAKE2b-256 | f63c6f20438c1d9f6ca912e1ecaaf30a14dcaba6d36866202411e48690e8b3bd |