PyQuickTest


NamePyQuickTest JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/quentinemusee/PyQuickTest
SummaryPyQuickTest is an experimental python testing framework designed to deliver an easy-and-quick-to-start python testing mechanism.
upload_time2023-08-09 13:35:24
maintainer
docs_urlNone
authorQuentin Raimbaud
requires_python
licensePSFL
keywords code testing experimental testing framework
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyQuickTest
PyQuickTest is an experimental python testing framework designed to  deliver an easy-and-quick-to-start python testing mechanism.


# Getting started
PyQuickTest test kit is divided into few categories:


## Decorators
### @is_test
*Transform the decorated function into a test function for the framework.*\
**example:**\
    *"my_function" is not a test.*\
    **def my_function():**\
        **ok()**\
    ~~~~~~~~~~~~\
    *"my_function" is a test.*\
    **@is_test()**\
    **def my_function():**\
        **ok()**

### @qpt_group
*Categorize the decorated function as belonging to the given groups and subgroups. Groups and subgroups should be given as arguments.*\
**example:**\
    *"my_function" has no test group.*\
    **@is_test()**\
    **def my_function():**\
        **ok()**\
    ~~~~~~~~~~~~~~\
    *"my_function" belong to the test group "Group".*\
    **@is_test()**\
    **@qpt_group("Group")**\
    **def my_function():**\
        **ok()**\
    ~~~~~~~~~~~~~~\
    *"my_function" belong to the test group "Group" and subgroup "Subgroup".*\
    **@is_test()**\
    **@qpt_group("Group", "Subgroup")**\
    **def my_function():**\
        **ok()**

### @qpt_execnbr
*Order the decorated test function to be run a given number of times.*\
**example:**\
    *"my_function" is run once.*\
    **@is_test()**\
    **def my_function():**\
        **ok()**\
    ~~~~~~~~~~~~\
    *"my_function" is run 100 times.*\
    **@is_test()**\
    **@qpt_execnbr(100)**\
    **def my_function():**\
        **ok()**

### @qpt_parametrize
*Use the given parameters to the test function.*\
**example:**\
    *"my_function" will fail once tested because no arg is provided.*\
    **@is_test()**\
    **def my_function(arg):**\
        **ok()**\
    ~~~~~~~~~~~~~~\
    *"my_function" will will be run with arg = 8.*\
    **@is_test()**\
    **@qpt_parametrize(8)**\
    **def my_function(arg):**\
        **ok()**\
    ~~~~~~~~~~~~~~\
    *"my_function" will will be run with arg1 = 8, arg2 = 'a' and arg3 = [45.19].*\
    **@is_test()**\
    **@qpt_parametrize(8, 'a', [45.19])**\
    **def my_function(arg1, arg2, arg3):**\
        **ok()**


## Assertion functions                                            
### ok
*Validate the current test.*\
**example:**\
    *The test "my_function" will pass.*\
    **@is_test()**\
    **def my_function(arg):**\
        **ok()**

### ko
*Unvalidate the current test with an optional error message.*\
**example:**\
    *The test "my_function" will fail.*\
    **@is_test()**\
    **def my_function(arg):**\
        **ko("This test failed!")**

### check
*Unvalidate the current test if the given boolean is False. An optional error message can be provided. If the given boolean is True, do nothing.*\
**example:**\
    *The test "my_function" will fail if the generated number 'a' is lower than 10.*\
    **@is_test()**\
    **def my_function(arg):**\
        **a = gen_int()**\
        **check(a > 10, "a isn't greater than 10")**\
        **ok()**

### ensure
*Validate or unvalidate the current test depending on the given boolean. An optional error message can be provided.*\
**example:**\
    *The test "my_function" will pass if the generated number 'a' if greater than 10, and fail otherwise.*\
    **@is_test()**\
    **def my_function(arg):**\
        **a = gen_int()**\
        **ensure(a > 10, "a isn't greater than 10")**


## Generator functions                                               
### gen_none
*Generate None.*
### gen_bool
*Generate a random boolean.*
### gen_int
*Generate a random integer. Min and max can be provided.*
### gen_signed_int
*Generate a random signed integer. Min / max can be given.*
### gen_float
*Generate a random float.*
### gen_signed_float
*Generate a random signed float. Min and max can be given.*
### gen_ascii_lower_char
*Generate a random ascii lower char.*
### gen_ascii_upper_char
*Generate a random ascii upper char.*
### gen_ascii_char
*Generate a random ascii char.*
### gen_ascii_lower_string
*Generate a random ascii lower string.*
### gen_ascii_upper_string
*Generate a random ascii upper string.*
### gen_ascii_string
*Generate a random ascii string.*
### gen_callable
*Generate a random callable. The number of arguments can be specified with nbr_args, as well as the generator function for the returned value with gen_return. If raised_exception = True, then the callable will raise an exception.*
### gen_generator
*Generate a random iterator. The iterator length can be provided, as well as the elements generator function with the gen_element argument.*
### gen_list
*Generate a random list. The list length can be provided, as well as the elements generator function with the the gen_element argument.*
### gen_dict
*Generate a random dict. The dict length can be provided, as well as the keys generator function with the the gen_keys argument, and the element generator function with the gen_element argument.*
### gen_random_value
*Generate a random value from any single value generator decorated with the "is_gen_value" flag attribute.*
### gen_random_iterable
*Generate a random iterable from any iterable generator decorated with the "is_gen_iterable" flag attribute.*
### gen_random
*Generate a random data from any generator decorated with the "is_gen" flag attribute.*


## Testing functions
### test_one
*Run a single test function. A few optional arguments can be provided, but if this function is directly used alone, only passing the test function as a parameter is certainly enough.*\
**example:**\
    *Run the test "my_function".*\
    **test_one(my_function)**\
    ~~~~~~~~~~~~~~~\
    *Run the test "my_function" with a printed prefix "==>" before the test result output.*\
    **test_one(**\
        **my_function,**\
        **prefix="==>"**\
    **)**\
    ~~~~~~~~~~~\
    *Run the test "my_function" with an indentation of 4 spaces and a printed prefix "==>" before the test result output.*\
    **test_one(**\
        **my_function,**\
        **prefix="==>"**\
        **indent=4**\
    **)**

### test_group                                                 
*Run a group of test functions. If you want to run a subgroup, pass every group and subgroup as a parameter. If no context is provided, it will be obtained by importing the caller file. If a filename is provided, the context will be retrieved from this file.*\
**example:**\
    *Run the test functions from group "G".*\
    **test_group("G")**\
    ~~~~~~~~~~\
    *Run the test functions from group "G" and subgroup "Subgroup".*\
    **test_group(**\
        **"G",**\
        **"Subgroup"**\
    **)**\
    ~~~~~~~~~\
    *Run the test functions from group "G", subgroup "SG" and sub-subgroup "SSG".*\
    **test_group(**\
        **"G",**\
        **"SG",**\
        **"SSG",**\
        **filename="tests.py"**\
    **)**

### test_all                                                     
*Run every test functions. If no context is provided, it will be obtained by importing the caller file. If a filename is provided, the context will be retrieved from this file.*\
**example:**\
    *Run the test functions from caller file context.*\
    **test_all()**\
    ~~~~~~\
    *Run the test functions from file "test.py".*\
    **test_all(**\
        **filename="tests.py"**\
    **)**


# Installation
TBA

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/quentinemusee/PyQuickTest",
    "name": "PyQuickTest",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Code testing,Experimental,Testing framework",
    "author": "Quentin Raimbaud",
    "author_email": "quentin.raimbaud.contact@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d2/6b/ab089a40133f5fa7afc32ada1f587b145817b20d10a364c7ac544179ed8d/PyQuickTest-0.1.0.tar.gz",
    "platform": null,
    "description": "# PyQuickTest\r\nPyQuickTest is an experimental python testing framework designed to  deliver an easy-and-quick-to-start python testing mechanism.\r\n\r\n\r\n# Getting started\r\nPyQuickTest test kit is divided into few categories:\r\n\r\n\r\n## Decorators\r\n### @is_test\r\n*Transform the decorated function into a test function for the framework.*\\\r\n**example:**\\\r\n    *\"my_function\" is not a test.*\\\r\n    **def my_function():**\\\r\n        **ok()**\\\r\n    ~~~~~~~~~~~~\\\r\n    *\"my_function\" is a test.*\\\r\n    **@is_test()**\\\r\n    **def my_function():**\\\r\n        **ok()**\r\n\r\n### @qpt_group\r\n*Categorize the decorated function as belonging to the given groups and subgroups. Groups and subgroups should be given as arguments.*\\\r\n**example:**\\\r\n    *\"my_function\" has no test group.*\\\r\n    **@is_test()**\\\r\n    **def my_function():**\\\r\n        **ok()**\\\r\n    ~~~~~~~~~~~~~~\\\r\n    *\"my_function\" belong to the test group \"Group\".*\\\r\n    **@is_test()**\\\r\n    **@qpt_group(\"Group\")**\\\r\n    **def my_function():**\\\r\n        **ok()**\\\r\n    ~~~~~~~~~~~~~~\\\r\n    *\"my_function\" belong to the test group \"Group\" and subgroup \"Subgroup\".*\\\r\n    **@is_test()**\\\r\n    **@qpt_group(\"Group\", \"Subgroup\")**\\\r\n    **def my_function():**\\\r\n        **ok()**\r\n\r\n### @qpt_execnbr\r\n*Order the decorated test function to be run a given number of times.*\\\r\n**example:**\\\r\n    *\"my_function\" is run once.*\\\r\n    **@is_test()**\\\r\n    **def my_function():**\\\r\n        **ok()**\\\r\n    ~~~~~~~~~~~~\\\r\n    *\"my_function\" is run 100 times.*\\\r\n    **@is_test()**\\\r\n    **@qpt_execnbr(100)**\\\r\n    **def my_function():**\\\r\n        **ok()**\r\n\r\n### @qpt_parametrize\r\n*Use the given parameters to the test function.*\\\r\n**example:**\\\r\n    *\"my_function\" will fail once tested because no arg is provided.*\\\r\n    **@is_test()**\\\r\n    **def my_function(arg):**\\\r\n        **ok()**\\\r\n    ~~~~~~~~~~~~~~\\\r\n    *\"my_function\" will will be run with arg = 8.*\\\r\n    **@is_test()**\\\r\n    **@qpt_parametrize(8)**\\\r\n    **def my_function(arg):**\\\r\n        **ok()**\\\r\n    ~~~~~~~~~~~~~~\\\r\n    *\"my_function\" will will be run with arg1 = 8, arg2 = 'a' and arg3 = [45.19].*\\\r\n    **@is_test()**\\\r\n    **@qpt_parametrize(8, 'a', [45.19])**\\\r\n    **def my_function(arg1, arg2, arg3):**\\\r\n        **ok()**\r\n\r\n\r\n## Assertion functions                                            \r\n### ok\r\n*Validate the current test.*\\\r\n**example:**\\\r\n    *The test \"my_function\" will pass.*\\\r\n    **@is_test()**\\\r\n    **def my_function(arg):**\\\r\n        **ok()**\r\n\r\n### ko\r\n*Unvalidate the current test with an optional error message.*\\\r\n**example:**\\\r\n    *The test \"my_function\" will fail.*\\\r\n    **@is_test()**\\\r\n    **def my_function(arg):**\\\r\n        **ko(\"This test failed!\")**\r\n\r\n### check\r\n*Unvalidate the current test if the given boolean is False. An optional error message can be provided. If the given boolean is True, do nothing.*\\\r\n**example:**\\\r\n    *The test \"my_function\" will fail if the generated number 'a' is lower than 10.*\\\r\n    **@is_test()**\\\r\n    **def my_function(arg):**\\\r\n        **a = gen_int()**\\\r\n        **check(a > 10, \"a isn't greater than 10\")**\\\r\n        **ok()**\r\n\r\n### ensure\r\n*Validate or unvalidate the current test depending on the given boolean. An optional error message can be provided.*\\\r\n**example:**\\\r\n    *The test \"my_function\" will pass if the generated number 'a' if greater than 10, and fail otherwise.*\\\r\n    **@is_test()**\\\r\n    **def my_function(arg):**\\\r\n        **a = gen_int()**\\\r\n        **ensure(a > 10, \"a isn't greater than 10\")**\r\n\r\n\r\n## Generator functions                                               \r\n### gen_none\r\n*Generate None.*\r\n### gen_bool\r\n*Generate a random boolean.*\r\n### gen_int\r\n*Generate a random integer. Min and max can be provided.*\r\n### gen_signed_int\r\n*Generate a random signed integer. Min / max can be given.*\r\n### gen_float\r\n*Generate a random float.*\r\n### gen_signed_float\r\n*Generate a random signed float. Min and max can be given.*\r\n### gen_ascii_lower_char\r\n*Generate a random ascii lower char.*\r\n### gen_ascii_upper_char\r\n*Generate a random ascii upper char.*\r\n### gen_ascii_char\r\n*Generate a random ascii char.*\r\n### gen_ascii_lower_string\r\n*Generate a random ascii lower string.*\r\n### gen_ascii_upper_string\r\n*Generate a random ascii upper string.*\r\n### gen_ascii_string\r\n*Generate a random ascii string.*\r\n### gen_callable\r\n*Generate a random callable. The number of arguments can be specified with nbr_args, as well as the generator function for the returned value with gen_return. If raised_exception = True, then the callable will raise an exception.*\r\n### gen_generator\r\n*Generate a random iterator. The iterator length can be provided, as well as the elements generator function with the gen_element argument.*\r\n### gen_list\r\n*Generate a random list. The list length can be provided, as well as the elements generator function with the the gen_element argument.*\r\n### gen_dict\r\n*Generate a random dict. The dict length can be provided, as well as the keys generator function with the the gen_keys argument, and the element generator function with the gen_element argument.*\r\n### gen_random_value\r\n*Generate a random value from any single value generator decorated with the \"is_gen_value\" flag attribute.*\r\n### gen_random_iterable\r\n*Generate a random iterable from any iterable generator decorated with the \"is_gen_iterable\" flag attribute.*\r\n### gen_random\r\n*Generate a random data from any generator decorated with the \"is_gen\" flag attribute.*\r\n\r\n\r\n## Testing functions\r\n### test_one\r\n*Run a single test function. A few optional arguments can be provided, but if this function is directly used alone, only passing the test function as a parameter is certainly enough.*\\\r\n**example:**\\\r\n    *Run the test \"my_function\".*\\\r\n    **test_one(my_function)**\\\r\n    ~~~~~~~~~~~~~~~\\\r\n    *Run the test \"my_function\" with a printed prefix \"==>\" before the test result output.*\\\r\n    **test_one(**\\\r\n        **my_function,**\\\r\n        **prefix=\"==>\"**\\\r\n    **)**\\\r\n    ~~~~~~~~~~~\\\r\n    *Run the test \"my_function\" with an indentation of 4 spaces and a printed prefix \"==>\" before the test result output.*\\\r\n    **test_one(**\\\r\n        **my_function,**\\\r\n        **prefix=\"==>\"**\\\r\n        **indent=4**\\\r\n    **)**\r\n\r\n### test_group                                                 \r\n*Run a group of test functions. If you want to run a subgroup, pass every group and subgroup as a parameter. If no context is provided, it will be obtained by importing the caller file. If a filename is provided, the context will be retrieved from this file.*\\\r\n**example:**\\\r\n    *Run the test functions from group \"G\".*\\\r\n    **test_group(\"G\")**\\\r\n    ~~~~~~~~~~\\\r\n    *Run the test functions from group \"G\" and subgroup \"Subgroup\".*\\\r\n    **test_group(**\\\r\n        **\"G\",**\\\r\n        **\"Subgroup\"**\\\r\n    **)**\\\r\n    ~~~~~~~~~\\\r\n    *Run the test functions from group \"G\", subgroup \"SG\" and sub-subgroup \"SSG\".*\\\r\n    **test_group(**\\\r\n        **\"G\",**\\\r\n        **\"SG\",**\\\r\n        **\"SSG\",**\\\r\n        **filename=\"tests.py\"**\\\r\n    **)**\r\n\r\n### test_all                                                     \r\n*Run every test functions. If no context is provided, it will be obtained by importing the caller file. If a filename is provided, the context will be retrieved from this file.*\\\r\n**example:**\\\r\n    *Run the test functions from caller file context.*\\\r\n    **test_all()**\\\r\n    ~~~~~~\\\r\n    *Run the test functions from file \"test.py\".*\\\r\n    **test_all(**\\\r\n        **filename=\"tests.py\"**\\\r\n    **)**\r\n\r\n\r\n# Installation\r\nTBA\r\n",
    "bugtrack_url": null,
    "license": "PSFL",
    "summary": "PyQuickTest is an experimental python testing framework designed to                            deliver an easy-and-quick-to-start python testing mechanism.",
    "version": "0.1.0",
    "project_urls": {
        "Download": "https://pypi.org/project/pyquicktest/",
        "Homepage": "https://github.com/quentinemusee/PyQuickTest"
    },
    "split_keywords": [
        "code testing",
        "experimental",
        "testing framework"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "41023d98e678fe40ff00b8d2b16311b5217b5553fed6db5f551163595380faf7",
                "md5": "6c9a954c89be2c42d457db70ae1e4d16",
                "sha256": "a537966d5116401637f00bbd9fd53a20a0508b0a4413c62367798e3af5f99e69"
            },
            "downloads": -1,
            "filename": "PyQuickTest-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6c9a954c89be2c42d457db70ae1e4d16",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 26263,
            "upload_time": "2023-08-09T13:35:22",
            "upload_time_iso_8601": "2023-08-09T13:35:22.268170Z",
            "url": "https://files.pythonhosted.org/packages/41/02/3d98e678fe40ff00b8d2b16311b5217b5553fed6db5f551163595380faf7/PyQuickTest-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d26bab089a40133f5fa7afc32ada1f587b145817b20d10a364c7ac544179ed8d",
                "md5": "836c92fe71d9cc556060fc4909ba7f58",
                "sha256": "1c9b8292e2b5075aa89519b8741c81a161d755ab4acef1ced28ed8ad69e4f75c"
            },
            "downloads": -1,
            "filename": "PyQuickTest-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "836c92fe71d9cc556060fc4909ba7f58",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 20861,
            "upload_time": "2023-08-09T13:35:24",
            "upload_time_iso_8601": "2023-08-09T13:35:24.084173Z",
            "url": "https://files.pythonhosted.org/packages/d2/6b/ab089a40133f5fa7afc32ada1f587b145817b20d10a364c7ac544179ed8d/PyQuickTest-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-09 13:35:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "quentinemusee",
    "github_project": "PyQuickTest",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyquicktest"
}
        
Elapsed time: 2.00410s