【问题标题】:Make pytest ignore pytest.ini让 pytest 忽略 pytest.ini
【发布时间】:2020-06-18 22:31:40
【问题描述】:

pytest 是否有命令行标志让它忽略 pytest.ini 文件?我看到--noconftest 标志禁用conftest.py,但pytest --help 似乎没有任何禁用pytest.ini 的功能。

【问题讨论】:

  • 我使用 pytest -c /dev/null,很可能 Windows 提供了类似的东西 (pytest -c NUL?)
  • 完全正确 - pytest -c NUL 在 Windows 下工作。
  • @hoefling 这应该是一个答案,而不是评论。

标签: python pytest


【解决方案1】:

AFAIK 现在pytest 不提供命令行选项来完全忽略配置。作为一种解决方法,您可以重命名 pytest.ini 或将 null 设备作为配置源传递:

$ pytest -c /dev/null

(或

$ pytest -c NUL

在 Windows 上)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-25
    • 1970-01-01
    • 2020-07-11
    • 2013-10-11
    相关资源
    最近更新 更多