Answer the question
In order to leave comments, you need to log in
Why does coverage.py show 80% of the tested model code in a Django project without a single test?
There are no tests created in the project, I launch coverage run --source='.' manage.py test
and get a picture on the screenshots below.
Does this mean that there is no need to test the code marked green in the report, since its work is provided by the framework mechanisms, and I just define the fields I need and cannot break anything? But then why is the PhoneNumberField field also marked tested on one of the screenshots, this mechanism is implemented by a third-party application and its correct operation is not guaranteed by Django? I apologize for the screenshots, but I don’t see a more visual way to present information.
Answer the question
In order to leave comments, you need to log in
You are shown covered with those lines that are executed when the module is imported. Class declaration and attribute class. That's where 80% comes from.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question