pytest的扩展参数化插件。
pytest-xpara的Python项目详细描述
pytest xpara是pytest的扩展参数化插件。
安装
pip install pytest-xpara
用法
py.test --xpara test_foo.py
示例
# test_foo.pyimportpytest@pytest.mark.xparametrizedeftest_bar(lhs,rhs):assertlhs==-rhs
# test_foo.yamltest_bar:args:lhs,rhsdata:-lhs:1rhs:-1-lhs:-1rhs:1dataids:-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上创建拉取请求。