[英]py.test: specifying python_files in the command line
I want to set the argument python_files
in pytest. 我想设置参数
python_files
在pytest。 The documentation says you need to put it in a configuration file, but I want to include it in the command line as part of the call to py.test
, so I won't have to add that configuration file. 文档说您需要将它放在配置文件中,但我想将它作为调用
py.test
一部分包含在命令行中,因此我不必添加该配置文件。 Is that possible? 那可能吗?
It is not possible with pytest out of the box as it is now (2.8). 开箱即用的pytest不可能像现在这样(2.8)。 The pytest parser knows about command-line options (
addoption/getoption
) and config file values ( addini/getini
) but they are quite separate. pytest 解析器知道命令行选项(
addoption/getoption
)和配置文件值( addini/getini
),但它们是完全分开的。
It is probably possible to write a plugin to add python_files
(or any other ini value) as a command-line option. 可能编写一个插件来添加
python_files
(或任何其他ini值)作为命令行选项。 But just adding a conftest file is certainly the simpler option. 但是添加一个conftest文件肯定是更简单的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.