跳转到主要内容

pytest的扩展参数化插件。

项目描述

pytest-xpara 是pytest的扩展参数化插件。

安装

pip install pytest-xpara

用法

py.test --xpara test_foo.py

示例

# test_foo.py
import pytest

@pytest.mark.xparametrize
def test_bar(lhs, rhs):
    assert lhs == -rhs
# test_foo.yaml
test_bar:
  args: lhs,rhs
  data:
    - lhs: 1
      rhs: -1
    - lhs: -1
      rhs: 1
  dataids:
    - left_to_right
    - right_to_left
$ py.test -v --xpara test_foo.py
========================== test session starts ===========================
platform darwin -- Python 2.7.12, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
cachedir: ../.cache
rootdir: /Users/tonyseek/Sites/pytest-xpara, inifile: setup.cfg
plugins: xpara-0.0.0, cov-2.4.0
collecting ... collected 2 items

test_foo.py::test_bar[left_to_right] PASSED
test_foo.py::test_bar[right_to_left] PASSED

======================== 2 passed in 0.03 seconds ========================

贡献

如果您想报告错误或请求功能,请随意在GitHub上打开问题或创建pull请求 [GitHub]

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

pytest_xpara-0.3.0.tar.gz (5.7 kB 查看哈希值)

上传时间

构建分发

pytest_xpara-0.3.0-py2.py3-none-any.whl (4.7 kB 查看哈希值)

上传时间 Python 2 Python 3

由以下支持