Skip to main content

pytest-play plugin with python expressions and assertions

Project description

play python

.. image::

.. image::

.. image::
:alt: Documentation Status

.. image::

pytest-play plugin with restricted Python expressions and assertions and it is
based on the ``RestrictedPython`` package.

``RestrictedPython`` is a tool that helps to define a subset of the Python
language which allows to provide a program input into a trusted environment.
RestrictedPython is not a sandbox system or a secured environment, but it helps
to define a trusted environment and execute untrusted code inside of it.



More info and examples on:

* pytest-play_, documentation
* cookiecutter-qa_, see ``pytest-play`` in action with a working example if you want to start hacking


This project defines the following pytest-play_ commands based on Python

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 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': '$bearer', 'Content-Type': 'application/json'}}}})'


``pytest-play`` tweets happens here:

* `@davidemoro`_


This package was created with Cookiecutter_ and the cookiecutter-play-plugin_ (based on `audreyr/cookiecutter-pypackage`_ project template).

.. _Cookiecutter:
.. _`audreyr/cookiecutter-pypackage`:
.. _`cookiecutter-play-plugin`:
.. _pytest-play:
.. _cookiecutter-qa:
.. _`@davidemoro`:


0.0.1 (2018-01-10)

* First release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for play-python, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size play_python-0.0.1-py2.py3-none-any.whl (5.7 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size play_python-0.0.1.tar.gz (13.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page