Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Completing Your Stack Class & Measuring Test Coverage

Comments & Discussion

ypochienTW on March 13, 2019

Simply and clear. Nice course for pytest newbie.

Chris on March 15, 2019

I may have missed it somewhere in the course, but the cov plugin was not installed by default on my windows machine while working in venv. I had to do a little googling to solve the error I received:

docs.pytest.org/en/latest/plugins.html?highlight=cov

Hope this helps someone in the future.

Rodrigo Vieira on March 17, 2019

Yes, definitively the “coverage” plugin is missing. We can simply install that by running:

pip install pytest-cov

Also, I don’t know why but all my “site-packages” files are getting returned by python -m pytest --cov. Does anyone know how to return only my project files as it’s returned on video lesson?

Isaac Dadzie on March 20, 2019

You can run the command.

python -m pytest -v --cov=ds

OR Create a .coveragerc file with following

[run]
source = ds

Your directory structure should look like this.

-rw-r--r-- 1 user user   17 Mar 20 12:14 .coveragerc
drwxr-xr-x 3 user user 4.0K Mar 20 11:25 ds/
drwxr-xr-x 3 user user 4.0K Mar 20 11:37 tests/

Become a Member to join the conversation.