pytest-sherlock
Pytest plugin which help to find coupled tests.
Sometimes we have coupled tests which depend from ordering
For example:
- PASSES
tests/exmaple/test_all_read.py tests/exmaple/test_b_modify.py tests/exmaple/test_c_delete.py - FAILED
tests/exmaple/test_c_delete.py tests/exmaple/test_b_modify.py tests/exmaple/test_all_read.py
In this case pretty simple to detect coupled tests, but if we have >=1k tests which called before it will hard
Content:
Install
pip install pytest-sherlock
how to use:
pytest tests/exmaple/test_c_delete.py tests/exmaple/test_b_modify.py tests/exmaple/test_all_read.py --flaky-test="test_read_params" -vv -x
Plugin didn't run all tests, it try to find some possible guilty test and will run first
======================================================================================== test session starts ========================================================================================
collected 3 items
Try to find coupled tests:
tests/exmaple/test_b_modify.py::test_modify_random_param PASSED [ 33%]
tests/exmaple/test_all_read.py::test_read_params FAILED [ 66%]
tests/exmaple/test_c_delete.py::test_delete_random_param PASSED [100%]
============================================================================================= FAILURES ==============================================================================================
Also you can use pytest -x or --exitfirst
======================================================================================== test session starts ========================================================================================
collected 3 items
Try to find coupled tests:
tests/exmaple/test_b_modify.py::test_modify_random_param PASSED [ 33%]
tests/exmaple/test_all_read.py::test_read_params FAILED [ 66%]
============================================================================================= FAILURES ==============================================================================================
TODO
I have a couple ideas, how to improve finder coupled tests:
- use AST for detect common peace of code (variables, functions, etc...)
- run not all tests (binary search algorithm)
- Also need to add tests for it =)
Metadata
Release files for pytest-sherlock 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest-sherlock-0.0.1.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_sherlock-0.0.1-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 8.6 kB
Release files / pytest-sherlock-0.0.1.tar.gz
| Download URL | pytest-sherlock-0.0.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
940dd4ef6973d64f2f477fc468e3f5c33d5f3b6a96460cf177da462a658aa5ad
|
|
BLAKE2b-256 checksum How to use checksums |
5d043d998c52547e7b38ade7e38912e9d9a9cee80c2ac13fce16b47193593e72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.16
|
Release files / pytest_sherlock-0.0.1-py2-none-any.whl
| Download URL | pytest_sherlock-0.0.1-py2-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
f040c609317a6d2d3e58db31353f6b97c4795af42584c5dfe9674acd84b7b346
|
|
BLAKE2b-256 checksum How to use checksums |
2f8ca64a92d2647ca86004e13677cb295f822fd424636a87767718723c8c5a5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.16
|