Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.1 (unreleased)

  • Add expect fixture to use directly in tests.

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.1b1

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.1b1
File Size Uploaded Provenance Actions
pytest-expecter-1.1b1.tar.gz 8.9 kB Without provenance Details for pytest-expecter-1.1b1.tar.gz

Built distribution (wheel)

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

Total release size: 24.0 kB

Release files / pytest-expecter-1.1b1.tar.gz

Download URL pytest-expecter-1.1b1.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0a0c06d0351b9fc46cc9558df3d15dc00c6e7e220275e1c310a1c9927fff191c
BLAKE2b-256 checksum
How to use checksums
2cce921a498761b31205316322e9168b1d9cac20fb4f7f6d255603030e8bb13f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pytest_expecter-1.1b1-py2-none-any.whl

Download URL pytest_expecter-1.1b1-py2-none-any.whl
Size 15.1 kB
Tags Python 2
SHA-256 checksum
How to use checksums
8b842ac7d266f619721e05e4cd5b509b8aa431c68598692990c000a98e5b893d
BLAKE2b-256 checksum
How to use checksums
4f09f9d482177a80b8de312cceda684e6152517e3256cbc44666bae400b2545b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pytest-expecter 1.1b1

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
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