partest


Namepartest JSON
Version 0.2.16 PyPI version JSON
download
home_pagehttps://github.com/Dec01/partest
SummaryThis is a module for the rapid implementation of test cases with coverage tracking. This module contains a call counter for specific endpoints and their methods. As well as the function of determining the types of tests that need to be counted.
upload_time2025-08-19 09:23:19
maintainerNone
docs_urlNone
authordec01
requires_python>=3.8
licenseNone
keywords autotest partest test coverage
VCS
bugtrack_url
requirements attrs certifi charset-normalizer Faker idna iniconfig jsonschema packaging pluggy py pyparsing pyrsistent pytest python-dateutil requests six tomli urllib3 pytest-repeat pytest-asyncio pydantic pytest-rerunfailures ruff allure-pytest allure-python-commons httpx swagger-parser matplotlib pyyaml fake-useragent
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Partest

This is a framework for API autotests with coverage assessment. Detailed instructions in the process of writing. It is better to check with the author how to use it. Tools are used:

* pytest
* httpx
* allure

Files are required for specific work:

**conftest.py** - it must have a fixture's inside:

```commandline
def pytest_addoption(parser):
    parser.addoption("--domain", action="store", default="http://url.ru")

@pytest.fixture(scope="session")
def domain(request):
    return request.config.getoption("--domain")
    
@pytest.fixture(scope="session")
def api_client(domain):
    return ApiClient(domain=domain)

@pytest.fixture(scope='session', autouse=True)
def clear_call_data():
    global call_count, call_type
    api_call_storage.call_count.clear()
    api_call_storage.call_type.clear()
    yield
```

**confpartest.py** - It must have variables inside:

```
swagger_files = {
    'test1': ['local', '../docs/openapi.yaml']
}

test_types_coverage = ['default', '405', 'param']
test_types_exception = ['health']

    """ swagger_files
    
        The **swagger_files** directory can have many items. The item key is the name of the swagger. Next, let's analyze the value
        in which the list with certain data is stored:
            0: 'local' or 'url'
            1: 'path'
            
        Example:
        
        swagger_files = {
            'test1': ['url', 'https://petstore.swagger.io/v2/swagger.json'],
            'test2': ['local', '../docs/openapi.yaml']
        }

    """
    """ test_types_coverage
    
        The **test_types_coverage** a list of test types, the amount of which is 100% coverage. List of available types:

        'default': The default type of test case.
        '405': The type of test case for 405 error.
        'params': The type of test case for parameters.
        'elem': The type of test case for elements.
        'generation_data': The type of test case for generation data.
        'health': The type of test case for health.
        'env': The type of test case for environment.
        
    """
        """ test_types_exception
    
        The **test_types_exception** contains a list of test types that are an exception. Applying this type of test to 
        an endpoint automatically counts as 100% coverage.
        
    """
```

The project must have a test that displays information about the coverage in allure. The name of it **test_zorro.py**:

```commandline
import allure
import pytest

from partest.zorro_report import zorro

@pytest.mark.asyncio
class TestCoverAge:

    async def test_display_final_call_counts(self):
        zorro()
        assert True

```

What does the test look like:

```commandline
    async def test_get(self, api_client):
        endpoint = 'https://ya.ru'
        response = await api_client.make_request(
            'GET',
            endpoint,
            params='limit=1',
            expected_status_code=200,
            validate_model=Models.ValidateGet,
            type=types.type_default
        )
        assert response is not None
        assert isinstance(response, dict)
```

All available data that the client can accept:
```
        Parameters
        ----------
        :param method: HTTP method to use.
        :param endpoint: The endpoint to make the request to.
        :param add_url1: Additional URL part 1.
        :param add_url2: Additional URL part 2.
        :param add_url3: Additional URL part 3.
        :param after_url: Additional URL part after the endpoint.
        :param defining_url: Defining URL.
        :param params: Query parameters.
        :param headers: Request headers.
        :param data: Request data.
        :param data_type: Request data type.
        :param files: Request files.
        :param expected_status_code: Expected status code.
        :param validate_model: Model to validate the response.
        :param type: Request type.
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Dec01/partest",
    "name": "partest",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "autotest partest test coverage",
    "author": "dec01",
    "author_email": "parschin.ewg@yandex.ru",
    "download_url": "https://files.pythonhosted.org/packages/31/7e/18ca8bf772e1a424e5dbddc2dcf8400614dc33126895387028f4e7fecfb9/partest-0.2.16.tar.gz",
    "platform": null,
    "description": "## Partest\r\n\r\nThis is a framework for API autotests with coverage assessment. Detailed instructions in the process of writing. It is better to check with the author how to use it. Tools are used:\r\n\r\n* pytest\r\n* httpx\r\n* allure\r\n\r\nFiles are required for specific work:\r\n\r\n**conftest.py** - it must have a fixture's inside:\r\n\r\n```commandline\r\ndef pytest_addoption(parser):\r\n    parser.addoption(\"--domain\", action=\"store\", default=\"http://url.ru\")\r\n\r\n@pytest.fixture(scope=\"session\")\r\ndef domain(request):\r\n    return request.config.getoption(\"--domain\")\r\n    \r\n@pytest.fixture(scope=\"session\")\r\ndef api_client(domain):\r\n    return ApiClient(domain=domain)\r\n\r\n@pytest.fixture(scope='session', autouse=True)\r\ndef clear_call_data():\r\n    global call_count, call_type\r\n    api_call_storage.call_count.clear()\r\n    api_call_storage.call_type.clear()\r\n    yield\r\n```\r\n\r\n**confpartest.py** - It must have variables inside:\r\n\r\n```\r\nswagger_files = {\r\n    'test1': ['local', '../docs/openapi.yaml']\r\n}\r\n\r\ntest_types_coverage = ['default', '405', 'param']\r\ntest_types_exception = ['health']\r\n\r\n    \"\"\" swagger_files\r\n    \r\n        The **swagger_files** directory can have many items. The item key is the name of the swagger. Next, let's analyze the value\r\n        in which the list with certain data is stored:\r\n            0: 'local' or 'url'\r\n            1: 'path'\r\n            \r\n        Example:\r\n        \r\n        swagger_files = {\r\n            'test1': ['url', 'https://petstore.swagger.io/v2/swagger.json'],\r\n            'test2': ['local', '../docs/openapi.yaml']\r\n        }\r\n\r\n    \"\"\"\r\n    \"\"\" test_types_coverage\r\n    \r\n        The **test_types_coverage** a list of test types, the amount of which is 100% coverage. List of available types:\r\n\r\n        'default': The default type of test case.\r\n        '405': The type of test case for 405 error.\r\n        'params': The type of test case for parameters.\r\n        'elem': The type of test case for elements.\r\n        'generation_data': The type of test case for generation data.\r\n        'health': The type of test case for health.\r\n        'env': The type of test case for environment.\r\n        \r\n    \"\"\"\r\n        \"\"\" test_types_exception\r\n    \r\n        The **test_types_exception** contains a list of test types that are an exception. Applying this type of test to \r\n        an endpoint automatically counts as 100% coverage.\r\n        \r\n    \"\"\"\r\n```\r\n\r\nThe project must have a test that displays information about the coverage in allure. The name of it **test_zorro.py**:\r\n\r\n```commandline\r\nimport allure\r\nimport pytest\r\n\r\nfrom partest.zorro_report import zorro\r\n\r\n@pytest.mark.asyncio\r\nclass TestCoverAge:\r\n\r\n    async def test_display_final_call_counts(self):\r\n        zorro()\r\n        assert True\r\n\r\n```\r\n\r\nWhat does the test look like:\r\n\r\n```commandline\r\n    async def test_get(self, api_client):\r\n        endpoint = 'https://ya.ru'\r\n        response = await api_client.make_request(\r\n            'GET',\r\n            endpoint,\r\n            params='limit=1',\r\n            expected_status_code=200,\r\n            validate_model=Models.ValidateGet,\r\n            type=types.type_default\r\n        )\r\n        assert response is not None\r\n        assert isinstance(response, dict)\r\n```\r\n\r\nAll available data that the client can accept:\r\n```\r\n        Parameters\r\n        ----------\r\n        :param method: HTTP method to use.\r\n        :param endpoint: The endpoint to make the request to.\r\n        :param add_url1: Additional URL part 1.\r\n        :param add_url2: Additional URL part 2.\r\n        :param add_url3: Additional URL part 3.\r\n        :param after_url: Additional URL part after the endpoint.\r\n        :param defining_url: Defining URL.\r\n        :param params: Query parameters.\r\n        :param headers: Request headers.\r\n        :param data: Request data.\r\n        :param data_type: Request data type.\r\n        :param files: Request files.\r\n        :param expected_status_code: Expected status code.\r\n        :param validate_model: Model to validate the response.\r\n        :param type: Request type.\r\n```\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "This is a module for the rapid implementation of test cases with coverage tracking. This module contains a call counter for specific endpoints and their methods. As well as the function of determining the types of tests that need to be counted.",
    "version": "0.2.16",
    "project_urls": {
        "Homepage": "https://github.com/Dec01/partest",
        "Source": "https://github.com/Dec01/partest"
    },
    "split_keywords": [
        "autotest",
        "partest",
        "test",
        "coverage"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d68fbe48b12f057cde857de73143664797763dee95a10a40fc65cd58b15153b1",
                "md5": "07bb8a2bee643044eabb5ff09f7cb5b1",
                "sha256": "fa6d677ff801833e866bf99a6040e1ec364e459bfd1c73183f5f5f6fc7e4f1d3"
            },
            "downloads": -1,
            "filename": "partest-0.2.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "07bb8a2bee643044eabb5ff09f7cb5b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 23313,
            "upload_time": "2025-08-19T09:23:17",
            "upload_time_iso_8601": "2025-08-19T09:23:17.955809Z",
            "url": "https://files.pythonhosted.org/packages/d6/8f/be48b12f057cde857de73143664797763dee95a10a40fc65cd58b15153b1/partest-0.2.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "317e18ca8bf772e1a424e5dbddc2dcf8400614dc33126895387028f4e7fecfb9",
                "md5": "517296e3e67b5450725f04ce5bf6015f",
                "sha256": "68fed556959783a7af5dd2113bb4ac4c732481a5616ef211aed63745c6d47a1a"
            },
            "downloads": -1,
            "filename": "partest-0.2.16.tar.gz",
            "has_sig": false,
            "md5_digest": "517296e3e67b5450725f04ce5bf6015f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 20073,
            "upload_time": "2025-08-19T09:23:19",
            "upload_time_iso_8601": "2025-08-19T09:23:19.300728Z",
            "url": "https://files.pythonhosted.org/packages/31/7e/18ca8bf772e1a424e5dbddc2dcf8400614dc33126895387028f4e7fecfb9/partest-0.2.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 09:23:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Dec01",
    "github_project": "partest",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "attrs",
            "specs": [
                [
                    "==",
                    "24.2.0"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2024.8.30"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.4.0"
                ]
            ]
        },
        {
            "name": "Faker",
            "specs": [
                [
                    ">=",
                    "13.12.0"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.10"
                ]
            ]
        },
        {
            "name": "iniconfig",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "jsonschema",
            "specs": [
                [
                    "==",
                    "4.22.0"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "25.0"
                ]
            ]
        },
        {
            "name": "pluggy",
            "specs": [
                [
                    "==",
                    "1.5.0"
                ]
            ]
        },
        {
            "name": "py",
            "specs": [
                [
                    "==",
                    "1.11.0"
                ]
            ]
        },
        {
            "name": "pyparsing",
            "specs": [
                [
                    "==",
                    "3.0.9"
                ]
            ]
        },
        {
            "name": "pyrsistent",
            "specs": [
                [
                    "==",
                    "0.18.1"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "==",
                    "8.3.3"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.9.0.post0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.17.0"
                ]
            ]
        },
        {
            "name": "tomli",
            "specs": [
                [
                    "==",
                    "2.2.1"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.4.0"
                ]
            ]
        },
        {
            "name": "pytest-repeat",
            "specs": [
                [
                    "==",
                    "0.9.4"
                ]
            ]
        },
        {
            "name": "pytest-asyncio",
            "specs": [
                [
                    ">=",
                    "0.23.7"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    "==",
                    "2.9.2"
                ]
            ]
        },
        {
            "name": "pytest-rerunfailures",
            "specs": [
                [
                    "~=",
                    "15.1"
                ]
            ]
        },
        {
            "name": "ruff",
            "specs": [
                [
                    "==",
                    "0.11.13"
                ]
            ]
        },
        {
            "name": "allure-pytest",
            "specs": [
                [
                    ">=",
                    "2.8.18"
                ]
            ]
        },
        {
            "name": "allure-python-commons",
            "specs": [
                [
                    "~=",
                    "2.13.5"
                ]
            ]
        },
        {
            "name": "httpx",
            "specs": [
                [
                    "~=",
                    "0.28.1"
                ]
            ]
        },
        {
            "name": "swagger-parser",
            "specs": [
                [
                    ">=",
                    "1.0.2"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    ">=",
                    "3.9.2"
                ]
            ]
        },
        {
            "name": "pyyaml",
            "specs": [
                [
                    ">=",
                    "6.0.2"
                ]
            ]
        },
        {
            "name": "fake-useragent",
            "specs": [
                [
                    ">=",
                    "2.2.0"
                ]
            ]
        }
    ],
    "lcname": "partest"
}
        
Elapsed time: 3.90974s