Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why won't pytest use pyproject.toml for this deprecation warning

I have a django project managed with pytest and poetry.

I'd like to put my pytest config into the pyproject.toml file, so I added:

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

However, this made no difference - the warning weren't filtered.

If I add a pytest.ini file containing the following...

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

... it works just fine.

What's wrong with my pyproject.toml, or my pytest configuration, that it's not being picked up?

like image 228
thclark Avatar asked Dec 12 '25 22:12

thclark


1 Answers

As per pytest's docs the section name should be [tool.pytest.ini_options]

like image 94
DeepSpace Avatar answered Dec 14 '25 14:12

DeepSpace