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).
class Engine: def rotations(self): return 51 def getTemp(self): return 75 def test_pass(): o = Engine() while o.rotations() < 50: pass assert o.getTemp() <= 75 def test_fail(): o = Engine() while o.rotations() < 50: pass assert o.getTemp() <= 70 def test_error(): o = Engine() while o.rotations() < 50: pass raise RuntimeError() assert o.getTemp() <= 75
Without pytest-finer-verdicts plugin, py.test test.py -v will produce the following output.
collected 3 items test.py::test_pass PASSED test.py::test_fail FAILED test.py::test_error FAILED =================================== FAILURES =================================== __________________________________ test_fail ___________________________________ def test_fail(): o = Engine() while o.rotations() < 50: pass > assert o.getTemp() <= 70 E assert 75 <= 70 E + where 75 = <bound method Engine.getTemp of <test.Engine object at 0x10597c6a0>>() E + where <bound method Engine.getTemp of <test.Engine object at 0x10597c6a0>> = <test.Engine object at 0x10597c6a0>.getTemp test.py:19: AssertionError __________________________________ test_error __________________________________ def test_error(): o = Engine() while o.rotations() < 50: pass > raise RuntimeError() E RuntimeError test.py:26: RuntimeError ====================== 2 failed, 1 passed in 0.04 seconds ======================
With pytest-finer-verdicts plugin, py.test test.py -v will produce the following output.
collected 3 items test.py::test_pass PASSED test.py::test_fail FAILED test.py::test_error ERROR ==================================== ERRORS ==================================== _________________________ ERROR at setup of test_error _________________________ def test_error(): o = Engine() while o.rotations() < 50: pass > raise RuntimeError() E RuntimeError test.py:26: RuntimeError =================================== FAILURES =================================== __________________________________ test_fail ___________________________________ def test_fail(): o = Engine() while o.rotations() < 50: pass > assert o.getTemp() <= 70 E assert 75 <= 70 E + where 75 = <bound method Engine.getTemp of <test.Engine object at 0x105885e80>>() E + where <bound method Engine.getTemp of <test.Engine object at 0x105885e80>> = <test.Engine object at 0x105885e80>.getTemp test.py:19: AssertionError ================= 1 failed, 1 passed, 1 error in 0.04 seconds ==================
Notice how test_error is flagged as a test error 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 Distributions
Close
Hashes for pytest-finer-verdicts-1.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcec7dbabb2515182e14239bf7cb10fb2f7d1cec9f9d45fdf7eb537ff041ede2 |
|
MD5 | 77baf43e4b351966faf2618f288d5c5d |
|
BLAKE2b-256 | 440693963430ff7d0d5e0216674f064760a72f14892c3bcd999aefdd66252e30 |
Close
Hashes for pytest_finer_verdicts-1.0.3-py3.6.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dace3441277555bdc1a605642b437fe76745f339d9c395581aa9255b533919a |
|
MD5 | 4e199355241328620c71edc1b44f9237 |
|
BLAKE2b-256 | 2e32acdbf155df4dc065541efccd9a724a9f56ba552217673c158a857d4dadb9 |
Close
Hashes for pytest_finer_verdicts-1.0.3-py3.5.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | f726dbb2552131e2e74236a0cb5f3d4838c321e65bae7f31d109d46bceeb4a8d |
|
MD5 | 1ed3e941653f84c14895861e25061bf6 |
|
BLAKE2b-256 | bdc07beaeaf573635151aa6b0822802ef92b635ecd1ba0e12068b7715c9898ce |
Close
Hashes for pytest_finer_verdicts-1.0.3-py3.4.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 577018a445404fdeddd1bbc47d9813ddee0236a548eddbe61eed012300e2426b |
|
MD5 | c4ff264715cb8700bcce218940c6ca37 |
|
BLAKE2b-256 | 377f74694c2a9a2f89fa51bc37213b4cacfd103b66d16b02fef0b16be779b5e1 |
Close
Hashes for pytest_finer_verdicts-1.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98b4b226eb68d93af6b9a78a73f81443400af2d0c3dd84206c3dd48b052578b1 |
|
MD5 | 6574218bc221b37ab201e61f17b56bd1 |
|
BLAKE2b-256 | 2eaf8bed5299161dd9b6b3849a975729698bad04c73b13d06d7fd04c0465481b |
Close
Hashes for pytest_finer_verdicts-1.0.3-py2.7.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a3236459b0cce02821f9159581c7b7ca8b534151a357d838fb76f40ae388e45 |
|
MD5 | 06547be09c4ecafb1afaed1d663d9f0e |
|
BLAKE2b-256 | 339fb9302e75d35b7ebd6f971f3a94d8ab5c5418693e2112f8f620a86ceea42c |