Wednesday, April 3, 2024

Configuring Pytest to Run Doctest | by Marcin Kozak | Apr, 2024

Must read


PYTHON PROGRAMMING

Discover ways to configure pytest in pyproject.toml to run doctests

Towards Data Science
Picture by Paul Hanaoka on Unsplash

Fashionable Python tasks are managed by pyproject.toml recordsdata. You need to use it to handle each common tasks and Python packages, which makes this file a common software to arrange Python tasks of assorted sorts.

The pyproject.toml file can include every thing your challenge wants, like:

  • Metadata, such because the identify of the challenge, model, authors, license, classifiers, URL, and outline (each brief and lengthy).
  • The configuration of the event and manufacturing surroundings, that means dependencies and optionally available dependencies.
  • Configuration of improvement instruments, equivalent to black, ruff, pylint, pytest, and plenty of others.

When the challenge will get huge, you’ll be able to transfer a lot of this info to different configuration recordsdata, like pytest.ini, necessities.txt, requirements_dev.txt, and so forth. However when a pyproject.toml doesn’t get overly lengthy, I maintain all the data inside it — this makes the challenge’s root listing small.

That is simply primary details about pyproject.toml recordsdata. If you wish to be taught extra about utilizing it, you are able to do so from right here:



Supply hyperlink

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article