thclark
thclark

Reputation: 5500

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?

Upvotes: 16

Views: 13207

Answers (1)

DeepSpace
DeepSpace

Reputation: 81664

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

Upvotes: 36

Related Questions