pytest-deduplicate


Namepytest-deduplicate JSON
Version 0.1.6 PyPI version JSON
download
home_page
SummaryIdentifies duplicate unit tests
upload_time2023-08-12 15:51:50
maintainer
docs_urlNone
author
requires_python>=3.8
licenseGPL
keywords duplicate test detection test optimization test efficiency
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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)
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pytest-deduplicate",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "duplicate test detection,test optimization,test efficiency",
    "author": "",
    "author_email": "xor2003 <xor2003@gmx.com>",
    "download_url": "https://files.pythonhosted.org/packages/f6/2a/66f7f131895df3e599897e65fa32fb7fcd17c2f10f3cad614eed8b59c472/pytest_deduplicate-0.1.6.tar.gz",
    "platform": null,
    "description": "# pytest_deduplicate\n\nThe pytest_deduplicate is designed to identify duplicate or superseeding unit tests that have the same or bigger code coverage. \nIt can be particularly useful when unit tests are automatically generated based on input/output information for a function, \nusing a large amount of available input data (for example, with the help of the auger library).\n\nThis tool groups each test together based on the coverage set. \nBy invoking unit testing with this tool, it will collect code coverage for each test and generate a list of duplicate tests. \nHowever, 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.\n\nTo use simply call:\n\n    cd <working_directory>\n    pytest_deduplicate [pytest_parameters]\n\nResult example:\n\n```\ndef function(x):\n    if x % 2 == 0:\n        for i in range(1, 3):\n            print(\"even\")\n        return True\n    else:\n        print(\"odd\")\n        return False\n\n\n    def test_even0(self):\n        self.assertEqual(function(0), True)\n\n    def test_even2(self):\n        self.assertEqual(function(2), True)\n\n    def test_odd(self):\n        self.assertEqual(function(3), False)\n\n    def test_evenodd(self):\n        self.assertEqual(function(2), True)\n        self.assertEqual(function(3), False)\n\n\nSuperseeded:\ntests/test_simple.py:25:1: I002 test TestSimple.test_evenodd covers more code when test(s) below (bigger-coverage)\ntests/test_simple.py:16:1: W003 test TestSimple.test_even0 covers less code when TestSimple.test_evenodd test (smaller-coverage)\ntests/test_simple.py:19:1: W003 test TestSimple.test_even2 covers less code when TestSimple.test_evenodd test (smaller-coverage)\ntests/test_simple.py:22:1: W003 test TestSimple.test_odd covers less code when TestSimple.test_evenodd test (smaller-coverage)\n\n\nDuplicates:\ntests/test_simple.py:16:1: W001 tests with same coverage: TestSimple.test_even0 (duplicate-test)\ntests/test_simple.py:19:1: W001 tests with same coverage: TestSimple.test_even2 (duplicate-test)\n```\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "Identifies duplicate unit tests",
    "version": "0.1.6",
    "project_urls": {
        "Homepage": "https://github.com/xor2003/pytest_deduplicate"
    },
    "split_keywords": [
        "duplicate test detection",
        "test optimization",
        "test efficiency"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a536a7874c2603233494f80adf820905614c1a00974b88b46748df0f0bdac19",
                "md5": "1aa9b4b2b433fcf67744b93c74b44faf",
                "sha256": "1b1e2f0fc143b814f5cc9d0827454002f498395f9c473cda667359c0edf32546"
            },
            "downloads": -1,
            "filename": "pytest_deduplicate-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1aa9b4b2b433fcf67744b93c74b44faf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 16488,
            "upload_time": "2023-08-12T15:51:48",
            "upload_time_iso_8601": "2023-08-12T15:51:48.557991Z",
            "url": "https://files.pythonhosted.org/packages/2a/53/6a7874c2603233494f80adf820905614c1a00974b88b46748df0f0bdac19/pytest_deduplicate-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f62a66f7f131895df3e599897e65fa32fb7fcd17c2f10f3cad614eed8b59c472",
                "md5": "996ea027487b241fc86335c50341abc7",
                "sha256": "581691c6a25918c558f0918e9f17d583b4f88f961b1304acf30d12b672dc73fb"
            },
            "downloads": -1,
            "filename": "pytest_deduplicate-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "996ea027487b241fc86335c50341abc7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 16210,
            "upload_time": "2023-08-12T15:51:50",
            "upload_time_iso_8601": "2023-08-12T15:51:50.502873Z",
            "url": "https://files.pythonhosted.org/packages/f6/2a/66f7f131895df3e599897e65fa32fb7fcd17c2f10f3cad614eed8b59c472/pytest_deduplicate-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-12 15:51:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xor2003",
    "github_project": "pytest_deduplicate",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pytest-deduplicate"
}
        
Elapsed time: 0.16180s