{ "info": { "author": "Davide Moro", "author_email": "davide.moro@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "===========\nplay python\n===========\n\n\n.. image:: https://img.shields.io/pypi/v/play_python.svg\n :target: https://pypi.python.org/pypi/play_python\n\n.. image:: https://img.shields.io/travis/tierratelematics/play_python.svg\n :target: https://travis-ci.org/tierratelematics/play_python\n\n.. image:: https://readthedocs.org/projects/play-python/badge/?version=latest\n :target: https://play-python.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://codecov.io/gh/tierratelematics/play_python/branch/develop/graph/badge.svg\n :target: https://codecov.io/gh/tierratelematics/play_python\n\n\npytest-play plugin with restricted Python expressions and assertions and it is\nbased on the ``RestrictedPython`` package.\n\n``RestrictedPython`` is a tool that helps to define a subset of the Python\nlanguage which allows to provide a program input into a trusted environment.\nRestrictedPython is not a sandbox system or a secured environment, but it helps\nto define a trusted environment and execute untrusted code inside of it.\n\nSee:\n\n* https://github.com/zopefoundation/RestrictedPython\n\nMore info and examples on:\n\n* pytest-play_, documentation\n* cookiecutter-qa_, see ``pytest-play`` in action with a working example if you want to start hacking\n\n\nFeatures\n========\n\n\nThis project defines the following pytest-play_ commands based on Python\nexpressions.\n\n\nStore variables\n---------------\n\nYou can store a pytest-play_ variables::\n\n {\n 'provider': 'python',\n 'type': 'store_variable',\n 'expression': '1+1',\n 'name': 'foo'\n }\n\nMake a Python assertion\n-----------------------\n\nYou can make an assertion based on a Python expression::\n\n {\n 'provider': 'python',\n 'type': 'assert',\n 'expression': 'variables[\"foo\"] == 2'\n }\n\nSleep\n-----\n\nSleep for a given amount of seconds::\n\n {\n 'provider': 'python',\n 'type': 'sleep',\n 'seconds': 2\n }\n\nExec a Python expresssion\n-------------------------\n\nYou can execute a Python expression::\n\n {\n 'provider': 'python',\n 'type': 'exec',\n 'expression': 'variables.update({'play_requests': {'parameters': {'headers': {'Authorization': '$bearer', 'Content-Type': 'application/json'}}}})'\n }\n\nWait until condition\n--------------------\n\nThe ``wait_until_not`` command waits until the wait expression is False::\n\n {\n 'provider': 'python',\n 'type': 'wait_until_not',\n 'expression': 'variables[\"expected_id\"] is not None and variables[\"expected_id\"][0] == $id',\n 'timeout': 5,\n 'poll': 0.1,\n 'subcommands': [{\n 'provider': 'play_sql',\n 'type': 'sql',\n 'database_url': 'postgresql://$db_user:$db_pwd@$db_host/$db_name',\n 'query': 'SELECT id FROM table WHERE id=$id ORDER BY id DESC;',\n 'variable': 'expected_id',\n 'expression': 'results.first()'\n }]\n }\n\nassuming that the subcommand updates the execution results updating a ``pytest-play``\nvariable (eg: ``expected_id``) where tipically the ``$id`` value comes\nfrom a previously executed command that causes an asynchrounous update on a relational\ndatabase soon or later (eg: a play_requests_ command making a ``HTTP POST`` call\nor a ``MQTT`` message coming from a simulated IoT device with play_mqtt_).\n\nThe wait command will try (and retry) to execute the subcommand with a poll frequency\n``poll`` (default: 0.1 seconds) until the provided ``timeout`` expressed\nin seconds expires or an exception occurs.\n\nYou can use the opposite command named ``wait_until`` that waits until the wait\nexpression is not False.\n\nLoop commands\n-------------\n\nYou can repeat a group of subcommands using a variable as a counter. Assuming you\nhave defined a ``countdown`` variable with 10 value, the wait until command will\nrepeat the group of commands for 10 times::\n\n play_json.execute_command({\n 'provider': 'python',\n 'type': 'wait_until',\n 'expression': 'variables[\"countdown\"] == 0',\n 'timeout': 0,\n 'poll': 0,\n 'sub_commands': [{\n 'provider': 'python',\n 'type': 'store_variable',\n 'name': 'countdown',\n 'expression': 'variables[\"countdown\"] - 1'\n }]\n })\n\nTwitter\n=======\n\n``pytest-play`` tweets happens here:\n\n* `@davidemoro`_\n\nCredits\n=======\n\nThis package was created with Cookiecutter_ and the cookiecutter-play-plugin_ (based on `audreyr/cookiecutter-pypackage`_ project template).\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n.. _`cookiecutter-play-plugin`: https://github.com/tierratelematics/cookiecutter-play-plugin\n.. _pytest-play: https://github.com/tierratelematics/pytest-play\n.. _cookiecutter-qa: https://github.com/tierratelematics/cookiecutter-qa\n.. _`@davidemoro`: https://twitter.com/davidemoro\n.. _play_requests: https://github.com/tierratelematics/play_requests\n.. _play_mqtt: https://github.com/tierratelematics/play_mqtt\n\n\n=======\nCHANGES\n=======\n\n0.1.1 (2018-01-17)\n------------------\n\n- add ``filter`` and ``map``\n\n\n0.1.0 (2018-01-16)\n------------------\n\n- add ``wait_until`` and ``wait_until_not`` commands\n\n- add ``datetime`` based expressions\n\n- add json ``dumps`` and ``loads`` based expressions\n\n\n0.0.1 (2018-01-10)\n------------------\n\n* First release\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tierratelematics/play_python", "keywords": "play_python", "license": "Apache Software License 2.0", "maintainer": "", "maintainer_email": "", "name": "play-python", "package_url": "https://pypi.org/project/play-python/", "platform": "", "project_url": "https://pypi.org/project/play-python/", "project_urls": { "Homepage": "https://github.com/tierratelematics/play_python" }, "release_url": "https://pypi.org/project/play-python/0.1.1/", "requires_dist": [ "pytest-play (>=1.0.0)", "RestrictedPython (>=4.0.b2)", "pytest; extra == 'tests'", "mock; extra == 'tests'", "pytest-cov; extra == 'tests'" ], "requires_python": "", "summary": "pytest-play plugin with python expressions and assertions", "version": "0.1.1" }, "last_serial": 3496762, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "44007886f252bfa66ea362956b54d1cd", "sha256": "3f05102dc67fa0cd6e44e2464e0d817f46b8fcec38cab5cffb474c79fe0e75ec" }, "downloads": -1, "filename": "play_python-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "44007886f252bfa66ea362956b54d1cd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5684, "upload_time": "2018-01-10T09:07:43", "url": "https://files.pythonhosted.org/packages/40/a1/8eff875589c88f3e82430c17c9362a2dcf4bae428045751f5f92de775c91/play_python-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "096d52b2b475bf8ac247eac1d5acb22d", "sha256": "7732644faf122a8871c103122baee0e383177fa4e70f8ce4d5476790cd7317f2" }, "downloads": -1, "filename": "play_python-0.0.1.tar.gz", "has_sig": false, "md5_digest": "096d52b2b475bf8ac247eac1d5acb22d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13036, "upload_time": "2018-01-10T09:07:44", "url": "https://files.pythonhosted.org/packages/b5/47/29e0ed065cdfae05132fe3aa1974f03f2a8b864403d55a478ab249d58cff/play_python-0.0.1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "6152065bc475ac64aedef02a3ee83581", "sha256": "90536614320ed60478cb359702403de55b66893728a42d624ba955e8e4149f3c" }, "downloads": -1, "filename": "play_python-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6152065bc475ac64aedef02a3ee83581", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7557, "upload_time": "2018-01-16T14:40:50", "url": "https://files.pythonhosted.org/packages/65/b0/55109189a2c2de9955997b0913b54e526636ce37539ab450e6ca2270c18d/play_python-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "711a0455f96c6bba8cb3d15b985a8fa6", "sha256": "495b4c06bb6b1298f753cb71f3aaf0d380dc30799d54567f67a8a1ccb398b820" }, "downloads": -1, "filename": "play_python-0.1.0.tar.gz", "has_sig": false, "md5_digest": "711a0455f96c6bba8cb3d15b985a8fa6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14826, "upload_time": "2018-01-16T14:40:52", "url": "https://files.pythonhosted.org/packages/15/e5/f7a13be619bdb49690e4d63ef2d3d8ac1bbc0a33dd3ff5fc3ed08d0b5fed/play_python-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "88a4f9bfed874bf33f209ce7ca6cc940", "sha256": "37784a7d8d53be68bda7b84ba81a04ad27d0e3bd60dd4a3e70dc89323a5fe480" }, "downloads": -1, "filename": "play_python-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "88a4f9bfed874bf33f209ce7ca6cc940", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7621, "upload_time": "2018-01-17T11:17:40", "url": "https://files.pythonhosted.org/packages/2b/ce/92c921f5e8fa7837463be4620ba4c5a0515c4a474970f950fbcd7cddb233/play_python-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e2be84eb29a5742aa49bc15e9784c154", "sha256": "a9ed9bd7ad5e8203d6aea5bcc2ff42f4ab3e9862984863e95485df2ef8fbe87a" }, "downloads": -1, "filename": "play_python-0.1.1.tar.gz", "has_sig": false, "md5_digest": "e2be84eb29a5742aa49bc15e9784c154", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15247, "upload_time": "2018-01-17T11:17:41", "url": "https://files.pythonhosted.org/packages/45/a8/bbbbeb269f4844551e1c7098544db1ec5b3453a91916f8ecd04d881162b8/play_python-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "88a4f9bfed874bf33f209ce7ca6cc940", "sha256": "37784a7d8d53be68bda7b84ba81a04ad27d0e3bd60dd4a3e70dc89323a5fe480" }, "downloads": -1, "filename": "play_python-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "88a4f9bfed874bf33f209ce7ca6cc940", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7621, "upload_time": "2018-01-17T11:17:40", "url": "https://files.pythonhosted.org/packages/2b/ce/92c921f5e8fa7837463be4620ba4c5a0515c4a474970f950fbcd7cddb233/play_python-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e2be84eb29a5742aa49bc15e9784c154", "sha256": "a9ed9bd7ad5e8203d6aea5bcc2ff42f4ab3e9862984863e95485df2ef8fbe87a" }, "downloads": -1, "filename": "play_python-0.1.1.tar.gz", "has_sig": false, "md5_digest": "e2be84eb29a5742aa49bc15e9784c154", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15247, "upload_time": "2018-01-17T11:17:41", "url": "https://files.pythonhosted.org/packages/45/a8/bbbbeb269f4844551e1c7098544db1ec5b3453a91916f8ecd04d881162b8/play_python-0.1.1.tar.gz" } ] }