pytest-play plugin with python expressions and assertions
Project description
===========
play python
===========
.. image:: https://img.shields.io/pypi/v/play_python.svg
:target: https://pypi-hypernode.com/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_python
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.
See:
* https://github.com/zopefoundation/RestrictedPython
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
Features
========
This project defines the following pytest-play_ commands based on Python
expressions.
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': '$bearer', 'Content-Type': 'application/json'}}}})'
}
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
=======
CHANGES
=======
0.0.1 (2018-01-10)
------------------
* First release
play python
===========
.. image:: https://img.shields.io/pypi/v/play_python.svg
:target: https://pypi-hypernode.com/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_python
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.
See:
* https://github.com/zopefoundation/RestrictedPython
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
Features
========
This project defines the following pytest-play_ commands based on Python
expressions.
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': '$bearer', 'Content-Type': 'application/json'}}}})'
}
=======
``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
=======
CHANGES
=======
0.0.1 (2018-01-10)
------------------
* First release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
play_python-0.0.1.tar.gz
(13.0 kB
view details)
Built Distribution
File details
Details for the file play_python-0.0.1.tar.gz
.
File metadata
- Download URL: play_python-0.0.1.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7732644faf122a8871c103122baee0e383177fa4e70f8ce4d5476790cd7317f2 |
|
MD5 | 096d52b2b475bf8ac247eac1d5acb22d |
|
BLAKE2b-256 | b54729e0ed065cdfae05132fe3aa1974f03f2a8b864403d55a478ab249d58cff |
Provenance
File details
Details for the file play_python-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: play_python-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f05102dc67fa0cd6e44e2464e0d817f46b8fcec38cab5cffb474c79fe0e75ec |
|
MD5 | 44007886f252bfa66ea362956b54d1cd |
|
BLAKE2b-256 | 40a18eff875589c88f3e82430c17c9362a2dcf4bae428045751f5f92de775c91 |