使用 tox.ini 定义具有动态值的 env 变量

问题描述

我想利用标记来运行 pytest 套件。 流程如下:

是否可以从另一个文件中读取这些参数?

使用此 this thread 中的 pll 示例

 [main]
    ignore_list = "E201,E202,E203,E221,E231,E241,E265,E266,E272,E402,W293,W391"
# to be read from another file
    
    [testenv]
    commands =
        pep8 \
        --max-line-length=120 \
        --ignore={[main]ignore_list}    

解决方法

您可以创建一个 bash 脚本来读取忽略列表,然后构建命令并最终运行它,而不是直接调用 pep8