【问题标题】:Why won't pytest use pyproject.toml for this deprecation warning为什么 pytest 不为此弃用警告使用 pyproject.toml
【发布时间】:2021-07-03 12:43:42
【问题描述】:

我有一个使用 pytest 和诗歌管理的 django 项目。

我想将我的 pytest 配置放入 pyproject.toml 文件中,所以我添加了:

[tool.pytest]
filterwarnings = ["ignore::django.utils.deprecation.RemovedInDjango40Warning", "ignore::django.utils.deprecation.RemovedInDjango41Warning"]

但是,这没有任何区别 - 警告没有被过滤。

如果我添加一个包含以下内容的 pytest.ini 文件...

[pytest]
filterwarnings =
    ignore::django.utils.deprecation.RemovedInDjango40Warning
    ignore::django.utils.deprecation.RemovedInDjango41Warning

...它工作得很好。

我的pyproject.toml 或我的 pytest 配置有什么问题,没有被拾取?

【问题讨论】:

    标签: python pytest pytest-django pyproject.toml


    【解决方案1】:

    根据pytest's docs,部分名称应为[tool.pytest.ini_options]

    【讨论】:

    • 太棒了,谢谢!最初实施 pyproject 支持时,我正在处理一个 github 问题表单,它一定是在他们保留 [tool.pytest] 以供将来使用之前。再次感谢!
    猜你喜欢
    • 1970-01-01
    • 2021-11-25
    • 2021-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多