Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report 0% on all templates not covered? #71

Closed
erdseb opened this issue May 26, 2020 · 10 comments
Closed

Report 0% on all templates not covered? #71

erdseb opened this issue May 26, 2020 · 10 comments

Comments

@erdseb
Copy link

erdseb commented May 26, 2020

Hi!

Thanks for making this plug-in and sharing it with the community as software libre! 👍
I noticed that right now only the templates that are actually touched by existing tests make it into the report, i.e. if no tests gets template X loaded, it will not appear with 0% in the report and hence the resulting picture is more optimistic than reality. Is there a way to get all templates of first party Django apps into the report?

Thanks and best

Sebastian

@erdseb
Copy link
Author

erdseb commented May 29, 2020

Any thoughts?

@erdseb
Copy link
Author

erdseb commented Jun 25, 2020

@nedbat do you have a minute?

@nedbat
Copy link
Owner

nedbat commented Jul 12, 2020

@erdseb I have not been doing work on this plugin recently, or for some time actually. I think this plugin should be finding unused templates. A quick look at the code suggests that only .htm or .html files are considered. Do you have differently named files?

Or, can you share a reproducible scenario with us?

@erdseb
Copy link
Author

erdseb commented Jul 14, 2020

Hi Ned, thanks for your reply!
I will try to create a minimal reproducible example, deal 👍

@erdseb
Copy link
Author

erdseb commented Jul 24, 2020

Or, can you share a reproducible scenario with us?

@nedbat yes! Please have a look at https://github.com/erdseb/django_coverage_plugin_issue_71_demo

@erdseb
Copy link
Author

erdseb commented Jul 31, 2020

Any thoughts?

@erdseb
Copy link
Author

erdseb commented Aug 18, 2020

@nedbat Please have a look at https://github.com/erdseb/django_coverage_plugin_issue_71_demo — I made it because you asked for it. Thank you!

@nedbat
Copy link
Owner

nedbat commented Aug 20, 2020

Thanks for the reproducible case. And sorry it took so long. And extra sorry that the answer is really simple, and I should have thought of it earlier. You need to use the --source=. option (or some other --source) on the coverage run command for it to search for unexecuted files. Once I do that with your example, both templates appear in the results.

I hope that helps.

@nedbat nedbat closed this as completed Aug 20, 2020
@erdseb
Copy link
Author

erdseb commented Aug 21, 2020

@nedbat I can confirm that use of source makes the 0% templates appear — nice!

(At the same time I'm getting a screen full of "already-imported" warnings now that no value of omit I tried seems to fix, even if I use source = django_coverage_plugin_issue_71_demo/ where the already-imported imported files — core Django from a venv — are not even located at. I guess that's another topic (and maybe a bug). I have commented about that in more detail at nedbat/coveragepy#905 (comment) now.)

@nedbat
Copy link
Owner

nedbat commented May 1, 2021

The already-imported warnings are now fixed in nedbat/coveragepy#1150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants