hypermodern-python
hypermodern-python copied to clipboard
Add pytest's best-practice config to `pyproject.toml`
The pyproject.toml file can be used to store pytest's config (otherwise declared in a separate pytest.ini file), see:
https://docs.pytest.org/en/6.2.x/customize.html#pyproject-toml
It could be valuable to add the recommended options for pytest:
- Treat warnings as errors by default: https://docs.pytest.org/en/7.2.x/reference/reference.html#confval-filterwarnings
- Use
importlibimport mode: https://docs.pytest.org/en/7.2.x/explanation/goodpractices.html#tests-outside-application-code
# pyproject.toml
[tool.pytest.ini_options]
filterwarnings = ["error"]
addopts = ["--import-mode=importlib"]
Note that the importlib option probably unnecessitates placing the hypermodern_python package in the src folder (src/hypermodern_python):
~src/hypermodern_python~ -> hypermodern_python