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
Plugin didn't run all tests, it try to find some possible guilty test and will run first
======================================================================================== test session starts ========================================================================================
collected 10 items
Try to find coupled tests
Step #1:
tests/exmaple/test_b_modify.py::test_modify_random_param PASSED [100%]
tests/exmaple/test_c_delete.py::test_delete_random_param PASSED [200%]
tests/exmaple/test_c_delete.py::test_deleted_passed PASSED [300%]
tests/exmaple/test_c_delete.py::test_do_not_delete PASSED [400%]
tests/exmaple/test_all_read.py::test_read_params COUPLED [500%]
Step #2:
tests/exmaple/test_b_modify.py::test_modify_random_param PASSED [500%]
tests/exmaple/test_c_delete.py::test_delete_random_param PASSED [500%]
tests/exmaple/test_all_read.py::test_read_params COUPLED [500%]
Step #3:
tests/exmaple/test_b_modify.py::test_modify_random_param PASSED [500%]
tests/exmaple/test_all_read.py::test_read_params COUPLED
TODO
I have a couple ideas, how to improve finder coupled tests:
- use AST for detect common peace of code (variables, functions, etc...)
- Also need to add tests for it =)
Metadata
Release files for pytest-sherlock 0.1.2
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.1.2.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_sherlock-0.1.2-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 11.1 kB
Release files / pytest-sherlock-0.1.2.tar.gz
| Download URL | pytest-sherlock-0.1.2.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba0bcfdeaf9d5c70b245f84f914f3d0611b25a824cffbc0c0f16a9cadcf3b833
|
|
BLAKE2b-256 checksum How to use checksums |
50598c12b8b0cd1aab70b916d1821e67d689483b22644807237ceec679677ad7
|
| 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.1.2-py2-none-any.whl
| Download URL | pytest_sherlock-0.1.2-py2-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
c07e3c9909dc254e83a29ce8c796eef30b345750a19c11b67065f13a8d97359f
|
|
BLAKE2b-256 checksum How to use checksums |
5ea6195ddfad4470f5b63e4e40392e121f87a4def96fcece139851ba4472503d
|
| 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
|