play-python 0.1.1

Last updated:

0 purchases

play-python 0.1.1 Image
play-python 0.1.1 Images
Add to Cart

Description:

playpython 0.1.1

===========play python===========.. image:: https://img.shields.io/pypi/v/play_python.svg :target: https://pypi.python.org/pypi/play_python.. image:: https://img.shields.io/travis/tierratelematics/play_python.svg :target: https://travis-ci.org/tierratelematics/play_python.. image:: https://readthedocs.org/projects/play-python/badge/?version=latest :target: https://play-python.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status.. image:: https://codecov.io/gh/tierratelematics/play_python/branch/develop/graph/badge.svg :target: https://codecov.io/gh/tierratelematics/play_pythonpytest-play plugin with restricted Python expressions and assertions and it isbased on the ``RestrictedPython`` package.``RestrictedPython`` is a tool that helps to define a subset of the Pythonlanguage which allows to provide a program input into a trusted environment.RestrictedPython is not a sandbox system or a secured environment, but it helpsto define a trusted environment and execute untrusted code inside of it.See:* https://github.com/zopefoundation/RestrictedPythonMore info and examples on:* pytest-play_, documentation* cookiecutter-qa_, see ``pytest-play`` in action with a working example if you want to start hackingFeatures========This project defines the following pytest-play_ commands based on Pythonexpressions.Store variables---------------You can store a pytest-play_ variables:: { 'provider': 'python', 'type': 'store_variable', 'expression': '1+1', 'name': 'foo' }Make a Python assertion-----------------------You can make an assertion based on a Python expression:: { 'provider': 'python', 'type': 'assert', 'expression': 'variables["foo"] == 2' }Sleep-----Sleep for a given amount of seconds:: { 'provider': 'python', 'type': 'sleep', 'seconds': 2 }Exec a Python expresssion-------------------------You can execute a Python expression:: { 'provider': 'python', 'type': 'exec', 'expression': 'variables.update({'play_requests': {'parameters': {'headers': {'Authorization': 'Extra close brace or missing open braceExtra close brace or missing open braceid`` value comesfrom a previously executed command that causes an asynchrounous update on a relationaldatabase soon or later (eg: a play_requests_ command making a ``HTTP POST`` callor a ``MQTT`` message coming from a simulated IoT device with play_mqtt_).The wait command will try (and retry) to execute the subcommand with a poll frequency``poll`` (default: 0.1 seconds) until the provided ``timeout`` expressedin seconds expires or an exception occurs.You can use the opposite command named ``wait_until`` that waits until the waitexpression is not False.Loop commands-------------You can repeat a group of subcommands using a variable as a counter. Assuming youhave defined a ``countdown`` variable with 10 value, the wait until command willrepeat the group of commands for 10 times:: play_json.execute_command({ 'provider': 'python', 'type': 'wait_until', 'expression': 'variables["countdown"] == 0', 'timeout': 0, 'poll': 0, 'sub_commands': [{ 'provider': 'python', 'type': 'store_variable', 'name': 'countdown', 'expression': 'variables["countdown"] - 1' }] })Twitter=======``pytest-play`` tweets happens here:* `@davidemoro`_Credits=======This package was created with Cookiecutter_ and the cookiecutter-play-plugin_ (based on `audreyr/cookiecutter-pypackage`_ project template)... _Cookiecutter: https://github.com/audreyr/cookiecutter.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage.. _`cookiecutter-play-plugin`: https://github.com/tierratelematics/cookiecutter-play-plugin.. _pytest-play: https://github.com/tierratelematics/pytest-play.. _cookiecutter-qa: https://github.com/tierratelematics/cookiecutter-qa.. _`@davidemoro`: https://twitter.com/davidemoro.. _play_requests: https://github.com/tierratelematics/play_requests.. _play_mqtt: https://github.com/tierratelematics/play_mqtt=======CHANGES=======0.1.1 (2018-01-17)------------------- add ``filter`` and ``map``0.1.0 (2018-01-16)------------------- add ``wait_until`` and ``wait_until_not`` commands- add ``datetime`` based expressions- add json ``dumps`` and ``loads`` based expressions0.0.1 (2018-01-10)------------------* First release

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.