为什么 pytest 不使用 pyproject.toml 来发出此弃用警告

thc*_*ark 14 python pytest pytest-django pyproject.toml

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

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

[tool.pytest]
filterwarnings = ["ignore::django.utils.deprecation.RemovedInDjango40Warning", "ignore::django.utils.deprecation.RemovedInDjango41Warning"]
Run Code Online (Sandbox Code Playgroud)

然而,这没有什么区别——警告没有被过滤。

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

[pytest]
filterwarnings =
    ignore::django.utils.deprecation.RemovedInDjango40Warning
    ignore::django.utils.deprecation.RemovedInDjango41Warning
Run Code Online (Sandbox Code Playgroud)

...效果很好。

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

Dee*_*ace 33

根据pytest 的文档,部分名称应该是[tool.pytest.ini_options]