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

Viewed 3174

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?

1 Answers

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

Related