A pytest plugin that allows multiple failures per test.
Project description
============
pytest-check
============
A pytest plugin that allows multiple failures per test.
----
This `Pytest`_ plugin was a rewrite and a rename of `pytest-expect`_.
Installation
------------
From PPI:
.. code-block:: bash
$ pip install pytest-check
Or from github.
.. code-block:: bash
$ pip install git+https://github.com/okken/pytest-check
Usage
-----
For example test case code:
.. code-block:: python
import pytest_check as check
def test_example():
a = 1
b = 2
c = [2, 4, 6]
check.greater(a, b)
check.less_equal(b, a)
check.is_in(a, c, "Is 1 in the list")
check.is_not_in(b, c, "make sure 2 isn't in list")
Test results:
.. code-block:: bash
=================================== FAILURES ===================================
_________________________________ test_example _________________________________
FAILURE:
assert 1 > 2
test_check.py, line 14, in test_example() -> check.greater(a, b)
FAILURE:
assert 2 <= 1
test_check.py, line 15, in test_example() -> check.less_equal(b, a)
FAILURE: Is 1 in the list
assert 1 in [2, 4, 6]
test_check.py, line 16, in test_example() -> check.is_in(a, c, "Is 1 in the list")
FAILURE: make sure 2 isn't in list
assert 2 not in [2, 4, 6]
test_check.py, line 17, in test_example() -> check.is_not_in(b, c, "make sure 2 isn't in list")
------------------------------------------------------------
Failed Checks: 4
=========================== 1 failed in 0.11 seconds ===========================
**Exist validations:**
- **check.equal** - *a == b*
- **check.not_equal** - *a != b*
- **check.is_true** - *bool(x) is True*
- **check.is_false** - *bool(x) is False*
- **check.is_none** - *x is None*
- **check.is_not_none** - *x is not None*
- **check.is_in** - *a in b*
- **check.not_in** - *a not in b*
- **check.is_instance** - *isinstance(a, b)*
- **check.not_is_instance** - *not isinstance(a, b)*
- **check.almost_equal** - *a == pytest.approx(b, rel, abs)* see at: `pytest.approx <https://docs.pytest.org/en/latest/reference.html#pytest-approx>`_
- **check.not_almost_equal** - *a != pytest.approx(b, rel, abs)* see at: `pytest.approx <https://docs.pytest.org/en/latest/reference.html#pytest-approx>`_
- **check.greater** - *a > b*
- **check.greater_equal** - *a >= b*
- **check.less** - *a < b*
- **check.less_equal** - *a <= b*
Contributing
------------
Contributions are very welcome. Tests can be run with `tox`_, please ensure
the coverage at least stays the same before you submit a pull request.
License
-------
Distributed under the terms of the `MIT`_ license, "pytest-check" is free and open source software
Issues
------
If you encounter any problems, please `file an issue`_ along with a detailed description.
.. _`MIT`: http://opensource.org/licenses/MIT
.. _`file an issue`: https://github.com/okken/pytest-check/issues
.. _`pytest`: https://github.com/pytest-dev/pytest
.. _`tox`: https://tox.readthedocs.io/en/latest/
.. _`pip`: https://pypi-hypernode.com/pypi/pip/
.. _`PyPI`: https://pypi-hypernode.com/pypi
.. _`pytest-expect`: https://github.com/okken/pytest-expect
pytest-check
============
A pytest plugin that allows multiple failures per test.
----
This `Pytest`_ plugin was a rewrite and a rename of `pytest-expect`_.
Installation
------------
From PPI:
.. code-block:: bash
$ pip install pytest-check
Or from github.
.. code-block:: bash
$ pip install git+https://github.com/okken/pytest-check
Usage
-----
For example test case code:
.. code-block:: python
import pytest_check as check
def test_example():
a = 1
b = 2
c = [2, 4, 6]
check.greater(a, b)
check.less_equal(b, a)
check.is_in(a, c, "Is 1 in the list")
check.is_not_in(b, c, "make sure 2 isn't in list")
Test results:
.. code-block:: bash
=================================== FAILURES ===================================
_________________________________ test_example _________________________________
FAILURE:
assert 1 > 2
test_check.py, line 14, in test_example() -> check.greater(a, b)
FAILURE:
assert 2 <= 1
test_check.py, line 15, in test_example() -> check.less_equal(b, a)
FAILURE: Is 1 in the list
assert 1 in [2, 4, 6]
test_check.py, line 16, in test_example() -> check.is_in(a, c, "Is 1 in the list")
FAILURE: make sure 2 isn't in list
assert 2 not in [2, 4, 6]
test_check.py, line 17, in test_example() -> check.is_not_in(b, c, "make sure 2 isn't in list")
------------------------------------------------------------
Failed Checks: 4
=========================== 1 failed in 0.11 seconds ===========================
**Exist validations:**
- **check.equal** - *a == b*
- **check.not_equal** - *a != b*
- **check.is_true** - *bool(x) is True*
- **check.is_false** - *bool(x) is False*
- **check.is_none** - *x is None*
- **check.is_not_none** - *x is not None*
- **check.is_in** - *a in b*
- **check.not_in** - *a not in b*
- **check.is_instance** - *isinstance(a, b)*
- **check.not_is_instance** - *not isinstance(a, b)*
- **check.almost_equal** - *a == pytest.approx(b, rel, abs)* see at: `pytest.approx <https://docs.pytest.org/en/latest/reference.html#pytest-approx>`_
- **check.not_almost_equal** - *a != pytest.approx(b, rel, abs)* see at: `pytest.approx <https://docs.pytest.org/en/latest/reference.html#pytest-approx>`_
- **check.greater** - *a > b*
- **check.greater_equal** - *a >= b*
- **check.less** - *a < b*
- **check.less_equal** - *a <= b*
Contributing
------------
Contributions are very welcome. Tests can be run with `tox`_, please ensure
the coverage at least stays the same before you submit a pull request.
License
-------
Distributed under the terms of the `MIT`_ license, "pytest-check" is free and open source software
Issues
------
If you encounter any problems, please `file an issue`_ along with a detailed description.
.. _`MIT`: http://opensource.org/licenses/MIT
.. _`file an issue`: https://github.com/okken/pytest-check/issues
.. _`pytest`: https://github.com/pytest-dev/pytest
.. _`tox`: https://tox.readthedocs.io/en/latest/
.. _`pip`: https://pypi-hypernode.com/pypi/pip/
.. _`PyPI`: https://pypi-hypernode.com/pypi
.. _`pytest-expect`: https://github.com/okken/pytest-expect
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-check-0.3.0.tar.gz
(4.1 kB
view details)
Built Distribution
File details
Details for the file pytest-check-0.3.0.tar.gz
.
File metadata
- Download URL: pytest-check-0.3.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4473c663cb92dd584582fcb0003587e7402d2f5c6756290f67a78f823be78bd |
|
MD5 | bce9b588cdb3281d1b77d758bbe9e367 |
|
BLAKE2b-256 | 42b47653dc0bf855ddadf6d6ef3a552571643df716061dd4b81ea95b957b4bfd |
File details
Details for the file pytest_check-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: pytest_check-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dd5536cf7590e7aa6832dd424463b51e50816e56f6a8365dc7dd4d0686725ef |
|
MD5 | 98966917bb942f5c1fd7d043b95f4829 |
|
BLAKE2b-256 | 3bdf19ff5f6a7d3d7d0a4905b246c1a05f82c71ef1ad28585a8194d56d9e0015 |