pytest_deduplicate
The pytest_deduplicate is designed to identify duplicate or superseeding unit tests that have the same or bigger code coverage. It can be particularly useful when unit tests are automatically generated based on input/output information for a function, using a large amount of available input data (for example, with the help of the auger library).
This tool groups each test together based on the coverage set. By invoking unit testing with this tool, it will collect code coverage for each test and generate a list of duplicate tests. However, it is important to note that false-positives may occur if, for example, there are regular expressions involved, as the code coverage in such cases may appear the same.
To use simply call:
cd <working_directory>
pytest_deduplicate [pytest_parameters]
Result example:
def function(x):
if x % 2 == 0:
for i in range(1, 3):
print("even")
return True
else:
print("odd")
return False
def test_even0(self):
self.assertEqual(function(0), True)
def test_even2(self):
self.assertEqual(function(2), True)
def test_odd(self):
self.assertEqual(function(3), False)
def test_evenodd(self):
self.assertEqual(function(2), True)
self.assertEqual(function(3), False)
Superseeded:
tests/test_simple.py:25:1: I002 test TestSimple.test_evenodd covers more code when test(s) below (bigger-coverage)
tests/test_simple.py:16:1: W003 test TestSimple.test_even0 covers less code when TestSimple.test_evenodd test (smaller-coverage)
tests/test_simple.py:19:1: W003 test TestSimple.test_even2 covers less code when TestSimple.test_evenodd test (smaller-coverage)
tests/test_simple.py:22:1: W003 test TestSimple.test_odd covers less code when TestSimple.test_evenodd test (smaller-coverage)
Duplicates:
tests/test_simple.py:16:1: W001 tests with same coverage: TestSimple.test_even0 (duplicate-test)
tests/test_simple.py:19:1: W001 tests with same coverage: TestSimple.test_even2 (duplicate-test)
Release files for pytest-deduplicate 0.1.6
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_deduplicate-0.1.6.tar.gz | 16.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_deduplicate-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:32.7 kB
Release files / pytest_deduplicate-0.1.6.tar.gz
| Download URL | pytest_deduplicate-0.1.6.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
581691c6a25918c558f0918e9f17d583b4f88f961b1304acf30d12b672dc73fb
|
|
BLAKE2b-256 checksum How to use checksums |
f62a66f7f131895df3e599897e65fa32fb7fcd17c2f10f3cad614eed8b59c472
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / pytest_deduplicate-0.1.6-py3-none-any.whl
| Download URL | pytest_deduplicate-0.1.6-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b1e2f0fc143b814f5cc9d0827454002f498395f9c473cda667359c0edf32546
|
|
BLAKE2b-256 checksum How to use checksums |
2a536a7874c2603233494f80adf820905614c1a00974b88b46748df0f0bdac19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|