允许设置粘贴配置文件的路径
pytest-paste-config的Python项目详细描述
pytest plugin to all传递粘贴配置文件的路径
用法
安装/更新方式:
pip install -U pytest-paste-config
要运行测试,请键入:
py.test
基本原理
这个插件纯粹是为了让我可以做到:
- def test_connection(pytestconfig):
- engine = engine_from_config(pytestconfig.paste_file) models.Base.metadata.create_all(engine) # some test code…
然后运行:
py.test –paste-file testing.ini