A pytest plugin to treat non-assertion failures as test errors.
Project description
pytest-finer-verdicts
A pytest plugin to treat non-assertion failures as test errors.
Getting the plugin
The plugin can be installed via pip install pytest-finer-verdicts. Similarly, it can be uninstalled via pip uninstall pytest-finer-verdicts.
Usage
Consider the following snippet in a file test.py (available as temp/test.py in the repository).
import pytest def test_pass(): assert 70 <= 75 def test_fail(): assert 75 <= 70 def test_error(): raise RuntimeError() def test_pytest_fail(): pytest.fail("Fail") def test_pytest_raises(): with pytest.raises(ValueError): raise IndexError()
Without pytest-finer-verdicts plugin, py.test test.py -v will produce the following output.
collected 5 items test.py::test_pass PASSED test.py::test_fail FAILED test.py::test_error ERROR test.py::test_pytest_fail FAILED test.py::test_pytest_raises ERROR ================================== ERRORS =================================== _______________________ ERROR at setup of test_error ________________________ def test_error(): > raise RuntimeError() E RuntimeError test.py:13: RuntimeError ___________________ ERROR at setup of test_pytest_raises ____________________ def test_pytest_raises(): with pytest.raises(ValueError): > raise IndexError() E IndexError test.py:22: IndexError ================================= FAILURES ================================== _________________________________ test_fail _________________________________ def test_fail(): > assert 75 <= 70 E assert 75 <= 70 test.py:9: AssertionError _____________________________ test_pytest_fail ______________________________ def test_pytest_fail(): > pytest.fail("Fail") E Failed: Fail test.py:17: Failed ================ 2 failed, 1 passed, 2 error in 0.05 seconds ================
Notice how test_error and test_pytest_raises are flagged as test errors by the plugin.
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
Close
Hashes for pytest-finer-verdicts-1.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e2b476836166b82d54a6b12d7d64349251899c153b7c61cfda532b67f6b7d5c |
|
MD5 | f38de477d3494d1b5223b5b66ff8b0a3 |
|
BLAKE2b-256 | 994db00913a7739c6f40a87176a1120fbc7c43590efa8829750957b4cca11d9a |
Close
Hashes for pytest_finer_verdicts-1.0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef632b6aab0a14746bebb717ba27df57a3d2b0afe74f2d8081d2de4adfbff52e |
|
MD5 | 895b0652e831c5b1f47ea35c10f6fed4 |
|
BLAKE2b-256 | 5333246c7cd3e9f9ee3ff4fa95c6b8e54409a039426d3e03306ec4bbf883559a |