测试会话元数据的pytest插件
pytest-metadata的Python项目详细描述
pytest元数据是"pytest<;http://pytest.org>;``的一个插件,它提供对测试会话元数据的访问。
图片::https://img.shields.io/badge/license mpl%202.0-blue.svg
:目标:https://github.com/pytest dev/pytest metadata/blob/master/license
:alt:license
。图片::https://img.shields.io/pypi/v/pytest metadata.svg
:目标:https://pypi.python.org/pypi/pytest metadata/
:alt:pypi
…图片::https://img.shields.io/travis/pytest dev/pytest metadata.svg
:目标:https://travis ci.org/pytest dev/pytest metadata/
…图片::https://img.shields.io/badge/code%20style-black-000000.svg
:目标:https://github.com/ambv/black
:alt:travis
…图片::https://img.shields.io/github/issues raw/pytest dev/pytest metadata.svg
:目标:https://github.com/pytest dev/pytest metadata/issues
:alt:issues
…图像::https://img.shields.io/requires/github/pytest dev/pytest metadata.svg
:目标:https://requires.io/github/pytest-dev/pytest-metadata/requirements/?branch=master
:alt:requirements
requirements
----
要使用pytest元数据,您需要以下先决条件:
-python 2.7、3.6、pypypy或pypypy3
installation
----
代码块::bash
$pip安装pytest元数据
development
----
有助于为pytest元数据做出贡献有助于
安装'pipenv<;https://pipenv.readthedocs.io/en/latest/>;`\br/>和'pre commit<;https://pre commit.com/>;`\uu。
代码块::bash
$pipenv install--dev
$pre commit install
running tests
代码块::bash
$pipenv run tox
可用元数据
---------
此插件收集以下元数据:
================================================================================================================================================================
python python 3.6.4版
darwin-17.4.0-x86-64位平台
pytest包{'py':'1.5.2',"Pytest":"3.4.1"}
插件Pytest插件{元数据':"1.6.0"}
=========================================
其他元数据
----
值对)通过在命令行中指定"`--metadata`":
pytest--metadata foo bar
注意:您可以提供多组"`--metadata``":
pytest--metadata foo bar--metadata baz zoo
continuous integration
在连续集成环境中,会从环境变量中添加额外的元数据。下面是受支持的连续集成提供程序的列表,以及指向环境变量的链接,如果这些环境变量存在,则这些环境变量将被添加到元数据中。
*`appveyor<;https://www.appveyor.com/docs/environment variables/>;`\br/>*`bitbucket<;https://confluence.atlassian.com/bitbucket/environment-variables-794502608.html>;``u
*`circleci<;https://circleci.com/docs/1.0/environment variables/>;``u
*`gitlab ci<;http://docs.gitlab.com/ce/ci/variables/readme.html>;``u
*`jenkins<;https://wiki.jenkins ci.org/display/jenkins/building+a+software+project;buildingasoftwareproject jenkinsetenvironmentvariables>;`
*`taskcluster<;https://docs.taskcluster.net/reference/workers/docker-worker/environment>;`
*`travis-ci<;https://docs.travis ci.com/user/environment variables/>;`
请注意,如果您使用的是"tox"<;http://tox.readthedocs.io/>;``若要运行测试,则需要"传递任何其他环境变量"<;http://tox.readthedocs.io/en/latest/example/basic.html;"传递环境变量">;`
以便提取这些变量。
查看元数据
----
运行测试时,在命令行上传递``--verbose`',则
元数据将显示在终端报告头中::
==test session starts===================================================================================================================pytest-3.4.1,py-1.5.2,pluggy-0.6.0--/usr/bin/python
cachedir:.pytest_cache
元数据:{python':'3.6.4','platform':'darwin-17.4.0-x86'u64-i386-64bit','packages':{pytest':'3.4.1','py':'1.5.2','pluggy':'0.6.0'},"插件":{"元数据":"1.6.0"}
插件:元数据-1.6.0
代码块::python
import pytest
@pytest.mark.optionalhook
def pytest_metadata(metadata):
metadata.pop("password",none)
代码块::python
def test_metadata(metadata):
assert'metadata'in metadata['plugins']
这可用于读取/添加/修改元数据:
…代码块::python
def pytest_configure(配置):
如果hasatt(配置,''u metadata'):
config.\u metadata['foo']='bar'
插件集成
----
这里有一个方便的插件列表,可以读取或贡献元数据:
*`pytest base url<;https://pypi.python.org/pypi/pytest base url/>;``uu-添加
元数据的基本URL。
*`pytest html<;https://pypi.python.org/pypi/pytest html/>;``在每个报表的开头显示
元数据。
*`pytest selenium<;https://pypi.python.org/pypi/pytest selenium/>;``将
驱动程序、功能和远程服务器添加到元数据。
资源
----
-`release notes<;http://github.com/davehunt/pytest metadata/blob/master/changes.rst>;` `-`issue tracker<;http://github.com/davehunt/pytest metadata/issues>;`-`code<;http://github.com/davehunt/pytest metadata/>;`
图片::https://img.shields.io/badge/license mpl%202.0-blue.svg
:目标:https://github.com/pytest dev/pytest metadata/blob/master/license
:alt:license
。图片::https://img.shields.io/pypi/v/pytest metadata.svg
:目标:https://pypi.python.org/pypi/pytest metadata/
:alt:pypi
…图片::https://img.shields.io/travis/pytest dev/pytest metadata.svg
:目标:https://travis ci.org/pytest dev/pytest metadata/
…图片::https://img.shields.io/badge/code%20style-black-000000.svg
:目标:https://github.com/ambv/black
:alt:travis
…图片::https://img.shields.io/github/issues raw/pytest dev/pytest metadata.svg
:目标:https://github.com/pytest dev/pytest metadata/issues
:alt:issues
…图像::https://img.shields.io/requires/github/pytest dev/pytest metadata.svg
:目标:https://requires.io/github/pytest-dev/pytest-metadata/requirements/?branch=master
:alt:requirements
requirements
----
要使用pytest元数据,您需要以下先决条件:
-python 2.7、3.6、pypypy或pypypy3
installation
----
代码块::bash
$pip安装pytest元数据
development
----
有助于为pytest元数据做出贡献有助于
安装'pipenv<;https://pipenv.readthedocs.io/en/latest/>;`\br/>和'pre commit<;https://pre commit.com/>;`\uu。
代码块::bash
$pipenv install--dev
$pre commit install
running tests
代码块::bash
$pipenv run tox
可用元数据
---------
此插件收集以下元数据:
================================================================================================================================================================
python python 3.6.4版
darwin-17.4.0-x86-64位平台
pytest包{'py':'1.5.2',"Pytest":"3.4.1"}
插件Pytest插件{元数据':"1.6.0"}
=========================================
其他元数据
----
值对)通过在命令行中指定"`--metadata`":
pytest--metadata foo bar
注意:您可以提供多组"`--metadata``":
pytest--metadata foo bar--metadata baz zoo
continuous integration
在连续集成环境中,会从环境变量中添加额外的元数据。下面是受支持的连续集成提供程序的列表,以及指向环境变量的链接,如果这些环境变量存在,则这些环境变量将被添加到元数据中。
*`appveyor<;https://www.appveyor.com/docs/environment variables/>;`\br/>*`bitbucket<;https://confluence.atlassian.com/bitbucket/environment-variables-794502608.html>;``u
*`circleci<;https://circleci.com/docs/1.0/environment variables/>;``u
*`gitlab ci<;http://docs.gitlab.com/ce/ci/variables/readme.html>;``u
*`jenkins<;https://wiki.jenkins ci.org/display/jenkins/building+a+software+project;buildingasoftwareproject jenkinsetenvironmentvariables>;`
*`taskcluster<;https://docs.taskcluster.net/reference/workers/docker-worker/environment>;`
*`travis-ci<;https://docs.travis ci.com/user/environment variables/>;`
请注意,如果您使用的是"tox"<;http://tox.readthedocs.io/>;``若要运行测试,则需要"传递任何其他环境变量"<;http://tox.readthedocs.io/en/latest/example/basic.html;"传递环境变量">;`
以便提取这些变量。
查看元数据
----
运行测试时,在命令行上传递``--verbose`',则
元数据将显示在终端报告头中::
cachedir:.pytest_cache
元数据:{python':'3.6.4','platform':'darwin-17.4.0-x86'u64-i386-64bit','packages':{pytest':'3.4.1','py':'1.5.2','pluggy':'0.6.0'},"插件":{"元数据":"1.6.0"}
插件:元数据-1.6.0
代码块::python
import pytest
@pytest.mark.optionalhook
def pytest_metadata(metadata):
metadata.pop("password",none)
代码块::python
def test_metadata(metadata):
assert'metadata'in metadata['plugins']
这可用于读取/添加/修改元数据:
…代码块::python
def pytest_configure(配置):
如果hasatt(配置,''u metadata'):
config.\u metadata['foo']='bar'
插件集成
----
这里有一个方便的插件列表,可以读取或贡献元数据:
*`pytest base url<;https://pypi.python.org/pypi/pytest base url/>;``uu-添加
元数据的基本URL。
*`pytest html<;https://pypi.python.org/pypi/pytest html/>;``在每个报表的开头显示
元数据。
*`pytest selenium<;https://pypi.python.org/pypi/pytest selenium/>;``将
驱动程序、功能和远程服务器添加到元数据。
资源
----
-`release notes<;http://github.com/davehunt/pytest metadata/blob/master/changes.rst>;` `-`issue tracker<;http://github.com/davehunt/pytest metadata/issues>;`-`code<;http://github.com/davehunt/pytest metadata/>;`