为什么pytest不使用pyproject.toml来显示此弃用警告

2024-06-08 10:00:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个django项目,由pytest和poetry管理

我想将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配置有什么问题,它没有被拾取


Tags: 文件项目djangopoetrypytestutilstoolpyproject