python - py.test : specifying python_files in the command line

标签 python testing pytest

我想在 pytest 中设置参数 python_files。文档说你需要把它放在一个配置文件中,但我想把它作为调用 py.test 的一部分包含在命令行中,所以我不必添加那个配置文件。这可能吗?

最佳答案

不可能像现在(2.8)那样开箱即用的 pytest。 pytest parser了解命令行选项 (addoption/getoption) 和配置文件值 (addini/getini),但它们完全不同。

可能可以编写一个插件来添加 python_files(或任何其他 ini 值)作为命令行选项。但只添加一个 conftest 文件肯定是更简单的选择。

关于python - py.test : specifying python_files in the command line,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34802006/

相关文章:

pytest - pytest生成报告后如何执行代码(使用pytest)?

python - 用属性替换实例的属性

java - 如何让测试等待 Vert.x Verticle 部署完成

python - 了解 python 引用计数以调试 c 扩展

python - pytest 无法导入通过 pip 安装且包含下划线的模块

testing - 代表的 Sould setter 在界面中?

python - Django 在自定义 404 页面上传输带有 MIME 类型文本/html 的样式表

python - Spacy 文本分类 : getting the error massage "' float' object is not iterable"

python - 使用正则表达式从字符串中提取所有电子邮件

angularjs - 使用 angularjs 测试 promise