Skip to main content

pytest-expecter

This is a fork of garybernhardt/expecter that hides the internal stack trace for pytest.

Build Status
PyPI Version

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

Revision History

1.0 (2017/12/03)

  • Initial stable release.

0.2.2.post7 (2017/12/02)

  • Added automatic conversion from OrderedDict to dict on Python 3.6 to create readable diffs.

Metadata

Release files for pytest-expecter 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-expecter 1.0
File Size Uploaded Provenance Actions
pytest-expecter-1.0.tar.gz 2.7 kB Without provenance Details for pytest-expecter-1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-expecter 1.0
File Interpreter ABI Platform Actions
pytest_expecter-1.0-py2-none-any.whl Python 2 none any Details for pytest_expecter-1.0-py2-none-any.whl

Total release size: 6.9 kB

Release files / pytest-expecter-1.0.tar.gz

Download URL pytest-expecter-1.0.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5736087ec9a41e4b92c2ca70fa648d1243f611cf70800bf7ce62300c3eb029ea
BLAKE2b-256 checksum
How to use checksums
38ec4e3ba69bb543fb926fcbf09998640128f878f97eb0bbdc2452a63b8edb3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pytest_expecter-1.0-py2-none-any.whl

Download URL pytest_expecter-1.0-py2-none-any.whl
Size 4.2 kB
Tags Python 2
SHA-256 checksum
How to use checksums
cc0c9ea5e2d11d3812cd1aea0957bf7747e0f2cac2bf695f9180658c88ebdbe0
BLAKE2b-256 checksum
How to use checksums
b8562a2a2c6cb48f279e9773b7826f3b4f8751a190a08b44d740155009a0e357
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pytest-expecter 1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page