Better testing with expecter and pytest.
Project description
# pytest-expecter
A `pytest` plugin for [garybernhardt/expecter](https://github.com/garybernhardt/expecter) that hides the internal stacktrace.
[![Build Status](http://img.shields.io/travis/jacebrowning/pytest-expecter/plugin.svg)](https://travis-ci.org/jacebrowning/pytest-expecter)
[![PyPI Version](http://img.shields.io/pypi/v/pytest-expecter.svg)](https://pypi.python.org/pypi/pytest-expecter)
## Overview
This lets you write tests (optionally using [ropez/pytest-describe](https://github.com/ropez/pytest-describe)) like this:
```python
def describe_foobar():
def it_can_pass(expect):
expect(2 + 3) == 5
def it_can_fail(expect):
expect(2 + 3) == 6
```
and get output like this:
```sh
=================================== FAILURES ===================================
_________________________ describe_foobar.it_can_fail __________________________
def it_can_fail(expect):
> expect(2 + 3) == 6
E AssertionError: Expected 6 but got 5
test_foobar.py:7: AssertionError
====================== 1 failed, 1 passed in 2.67 seconds ======================
```
## Installation
```sh
pip install pytest-expecter
```
# Revision History
## 1.3 (unreleased)
- Added `startswith`, `endswith`, `istartswith`, and `iendswith` helpers.
- Added support for Python 3.7.
## 1.2 (2018/03/17)
- Added `icontains` method to check for containment ignoring case.
- Added `iexcludes` method to check for exclusion ignoring case.
## 1.1 (2018/02/21)
- Added `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.
A `pytest` plugin for [garybernhardt/expecter](https://github.com/garybernhardt/expecter) that hides the internal stacktrace.
[![Build Status](http://img.shields.io/travis/jacebrowning/pytest-expecter/plugin.svg)](https://travis-ci.org/jacebrowning/pytest-expecter)
[![PyPI Version](http://img.shields.io/pypi/v/pytest-expecter.svg)](https://pypi.python.org/pypi/pytest-expecter)
## Overview
This lets you write tests (optionally using [ropez/pytest-describe](https://github.com/ropez/pytest-describe)) like this:
```python
def describe_foobar():
def it_can_pass(expect):
expect(2 + 3) == 5
def it_can_fail(expect):
expect(2 + 3) == 6
```
and get output like this:
```sh
=================================== FAILURES ===================================
_________________________ describe_foobar.it_can_fail __________________________
def it_can_fail(expect):
> expect(2 + 3) == 6
E AssertionError: Expected 6 but got 5
test_foobar.py:7: AssertionError
====================== 1 failed, 1 passed in 2.67 seconds ======================
```
## Installation
```sh
pip install pytest-expecter
```
# Revision History
## 1.3 (unreleased)
- Added `startswith`, `endswith`, `istartswith`, and `iendswith` helpers.
- Added support for Python 3.7.
## 1.2 (2018/03/17)
- Added `icontains` method to check for containment ignoring case.
- Added `iexcludes` method to check for exclusion ignoring case.
## 1.1 (2018/02/21)
- Added `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.
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
pytest-expecter-1.3b3.tar.gz
(11.4 kB
view details)
Built Distribution
File details
Details for the file pytest-expecter-1.3b3.tar.gz
.
File metadata
- Download URL: pytest-expecter-1.3b3.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.2.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c240ddde3b50b6dc2ff08162ac51971881d65c3209e149a6d05224efe9dcaac |
|
MD5 | 471b5cec803b86fecff20adf2eff2f9d |
|
BLAKE2b-256 | a56fe4545ec1b14f7a00880165abb41451a571ccfb3df49884f9d734488dbb3c |
File details
Details for the file pytest_expecter-1.3b3-py2-none-any.whl
.
File metadata
- Download URL: pytest_expecter-1.3b3-py2-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.2.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e688a0e66d31d11168667d3c85f89ae9d34671e6e55fd93a0243f1987102dbeb |
|
MD5 | 701e1f5cde675ff1e830edd2fd24a312 |
|
BLAKE2b-256 | 054c37fd6f7e3a61f80cbe28b8d632535dc4077b5b1d02d297107e72a29c4259 |