带有python表达式和断言的pytest play插件
play-python的Python项目详细描述
===
播放python
===
图片::https://img.shields.io/pypi/v/play_python.svg
:目标:https://pypi.python.org/pypi/play_python
…图片::https://img.shields.io/travis/tierratelematics/play_python.svg
:目标:https://travis ci.org/tierratelematics/play_python
…图片::https://readthedocs.org/projects/play-python/badge/?version=latest
:目标:https://play-python.readthedocs.io/en/latest/?徽章=最新
:alt:文档状态
…图片::https://codecov.io/gh/tierratelematics/play_python/branch/develop/graph/badge.svg
:目标:https://codecov.io/gh/tierratelematics/play_python
pytest play plugin,带有受限制的python表达式和断言,它基于"restrictedpython"包。
``restrictedpython``是一个帮助定义python语言子集的工具,该语言允许向可信环境提供程序输入。
restrictedpython不是沙箱系统或安全环境,但它有助于
定义可信环境并执行其中包含受信任的代码。
请参见:
*https://github.com/zopefoundation/restrictedpython
特性
=
此项目基于python
表达式定义以下pytest-play命令。
store variables
----
您可以存储pytest-play变量::
{
"provider":"python",
"type":"store variable',
'表达式':'1+1',
'名称':'foo'
}
make a python assertion
-
>您可以基于python表达式生成断言::
{
'提供程序':'python',
'类型':'assert',
'表达式':'variables["foo"]==2'
}
sleep
----
>在给定的时间内睡眠::
{
"provider":"python",
"type":"sleep",
"seconds":2
}
HON表达式::
{
‘提供程序’:‘python’,
‘类型’:‘exec’,
‘表达式’:‘变量。更新({‘播放请求’:{‘参数’:{‘头’:{‘授权’:'$bearer',‘内容类型’:‘应用程序/json’}}})
}
---——
``wait\u unt``命令等待,直到等待表达式为false:
{
{'provider':'python',
'type':'wait\u unt',
'expression':'variables["expected\u id"]不是none,variables["expected\u id"][0]=$id',
'timeout':5,,
"poll":0.1,
"子命令":[{
"提供程序":"播放SQL",
"类型":"SQL",
"数据库URL":"postgresql://$db用户:$db pwd@$db主机/$db名称",
"查询":"从表中选择id,其中id=$id order by id desc;,
"变量":"ex"预期的"id",
"表达式":"results.first()"
}
}
很快或稍后对关系数据库进行异步更新(例如:play_requests_u命令发出"http post"调用或"mqtt"消息,消息来自play_qtt_u的模拟物联网设备)。
wait命令将尝试(并重试)以轮询频率执行子命令
``poll``(默认值:0.1秒),直到提供的以秒为单位的"超时"过期或发生异常。
一个名为"wait\u until"的相反命令,它等待wait
表达式不为false。
loop commands
----
可以使用变量作为计数器重复一组子命令。假设您已经用10个值定义了一个"countdown"变量,那么wait until命令将
重复这组命令10次:
play_json.execute_command({
"provider":"python",
"type":"wait_until",
"expression":"variables["countdown"]==0,
‘超时’:0,
‘轮询’:0,
‘子命令’:[{
‘提供程序’:‘python’,
‘类型’:‘存储变量’,
‘名称’:‘倒计时’,
‘表达式’:‘变量[‘倒计时’]-1’
}
twitter
==
``pytest play``在这里发推:
*`@davidemoro`
===
这个包是用cookiecutter和cookiecutter-play-plugin创建的(基于'audreyr/cookiecutter pypackage``项目模板)。
_ 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
。_播放请求:https://github.com/tierratelematics/play_requests
…_游玩:https://github.com/tierrartelematicatics/play-mqtt
==
=
=
=
=
=
<0.1.1.1(2018-01-17)
=-
=>
-增加``过滤器``和``地图`
=>
=>
=>
=>
=>
==>
-增加等到``和``等到```命令
-添加基于"datetime"的表达式
-添加基于json的"dumps"和基于"loads"的表达式
>0.0.1(2018-01-10)
----
*第一次发布
播放python
===
图片::https://img.shields.io/pypi/v/play_python.svg
:目标:https://pypi.python.org/pypi/play_python
…图片::https://img.shields.io/travis/tierratelematics/play_python.svg
:目标:https://travis ci.org/tierratelematics/play_python
…图片::https://readthedocs.org/projects/play-python/badge/?version=latest
:目标:https://play-python.readthedocs.io/en/latest/?徽章=最新
:alt:文档状态
…图片::https://codecov.io/gh/tierratelematics/play_python/branch/develop/graph/badge.svg
:目标:https://codecov.io/gh/tierratelematics/play_python
pytest play plugin,带有受限制的python表达式和断言,它基于"restrictedpython"包。
``restrictedpython``是一个帮助定义python语言子集的工具,该语言允许向可信环境提供程序输入。
restrictedpython不是沙箱系统或安全环境,但它有助于
定义可信环境并执行其中包含受信任的代码。
请参见:
*https://github.com/zopefoundation/restrictedpython
特性
=
此项目基于python
表达式定义以下pytest-play命令。
store variables
----
您可以存储pytest-play变量::
{
"provider":"python",
"type":"store variable',
'表达式':'1+1',
'名称':'foo'
}
make a python assertion
-
>您可以基于python表达式生成断言::
{
'提供程序':'python',
'类型':'assert',
'表达式':'variables["foo"]==2'
}
sleep
----
>在给定的时间内睡眠::
{
"provider":"python",
"type":"sleep",
"seconds":2
}
HON表达式::
{
‘提供程序’:‘python’,
‘类型’:‘exec’,
‘表达式’:‘变量。更新({‘播放请求’:{‘参数’:{‘头’:{‘授权’:'$bearer',‘内容类型’:‘应用程序/json’}}})
}
---——
``wait\u unt``命令等待,直到等待表达式为false:
{
{'provider':'python',
'type':'wait\u unt',
'expression':'variables["expected\u id"]不是none,variables["expected\u id"][0]=$id',
'timeout':5,,
"poll":0.1,
"子命令":[{
"提供程序":"播放SQL",
"类型":"SQL",
"数据库URL":"postgresql://$db用户:$db pwd@$db主机/$db名称",
"查询":"从表中选择id,其中id=$id order by id desc;,
"变量":"ex"预期的"id",
"表达式":"results.first()"
}
}
很快或稍后对关系数据库进行异步更新(例如:play_requests_u命令发出"http post"调用或"mqtt"消息,消息来自play_qtt_u的模拟物联网设备)。
wait命令将尝试(并重试)以轮询频率执行子命令
``poll``(默认值:0.1秒),直到提供的以秒为单位的"超时"过期或发生异常。
一个名为"wait\u until"的相反命令,它等待wait
表达式不为false。
loop commands
----
可以使用变量作为计数器重复一组子命令。假设您已经用10个值定义了一个"countdown"变量,那么wait until命令将
重复这组命令10次:
play_json.execute_command({
"provider":"python",
"type":"wait_until",
"expression":"variables["countdown"]==0,
‘超时’:0,
‘轮询’:0,
‘子命令’:[{
‘提供程序’:‘python’,
‘类型’:‘存储变量’,
‘名称’:‘倒计时’,
‘表达式’:‘变量[‘倒计时’]-1’
}
==
``pytest play``在这里发推:
*`@davidemoro`
这个包是用cookiecutter和cookiecutter-play-plugin创建的(基于'audreyr/cookiecutter pypackage``项目模板)。
_ 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
。_播放请求:https://github.com/tierratelematics/play_requests
…_游玩:https://github.com/tierrartelematicatics/play-mqtt
==
=
=
=
=
=
<0.1.1.1(2018-01-17)
=-
=>
-增加``过滤器``和``地图`
=>
=>
=>
=>
=>
==>
-增加等到``和``等到```命令
-添加基于"datetime"的表达式
-添加基于json的"dumps"和基于"loads"的表达式
>0.0.1(2018-01-10)
----
*第一次发布