Pytest: How to set default import-mode to importlib?

Viewed 281

pytest-6.0 introduced a new 'import-mode' option dubbed 'importlib' along with the declaration:

"We intend to make importlib the default in future releases."

If I adopt it in advance, I'm not sure how I will go remembering to always specify --import-mode=importlib on the command line. I tried adding a few variations to the [tool.pytest.ini_options] tag in pyproject.toml without success.

Is there some way I can specify it in a config file?

1 Answers

In pyproject.toml this seems to work...

[tool.pytest.ini_options]
addopts = "--import-mode=importlib"
Related