hypermodern-python icon indicating copy to clipboard operation
hypermodern-python copied to clipboard

Add pytest's best-practice config to `pyproject.toml`

Open jond01 opened this issue 3 years ago • 0 comments

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 importlib import 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

jond01 avatar Nov 30 '22 20:11 jond01