How to run tests without installing package?

I know this question has been already closed, but a simple way I often use is to call pytest via python -m, from the root (the parent of the package).

$ python -m pytest tests

This works because -m option adds the current directory to the python path, and hence mypkg is detected as a local package (not as the installed).

See:
https://docs.pytest.org/en/latest/usage.html#calling-pytest-through-python-m-pytest

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)