Rodrigo Girão Serrão 🐍🚀 @mathspp.com · Jan 30

One of my students today made this mistake. If you have a project and want to test it, your tests will import your project. So, you need to install pytest as a dependency INSIDE your project. If you install it globally, when you run it, it can't see your own project.

0 likes 2 replies

?

Replies

Tin Tvrtković · Jan 31

Yes from a practical perspective (sure, it needs to import the code) but also from a logical perspective. If you have pytest unit tests, pytest is a (dev) dependency of your project. If you format your files, Black or ruff is a dependency of your project. Same for Mypy. They should all be listed.

Rodrigo Girão Serrão 🐍🚀 · Jan 30

Then, run it with `uv run pytest` and uv will automatically pick up the pytest installed locally, as a dependency.