django_coverage_plugin
django_coverage_plugin copied to clipboard
need concrete examples of .coveragerc template configuration
Hello,
I cannot get this plugin configured to process my template directories. There is no relevant example code either here or at the main https://coverage.readthedocs.org. https://coverage.readthedocs.org/en/coverage-4.0.3/config.html#config
Please add a sample .coveragerc based on the django standard layout for templates.
Thank you.
@edwardotis can you show what you tried, and what happened?
If you are using LiveServerTestCases - or any non-single-process test - you have to follow the coverage docs for parallel/multiprocessing and use coverage combine
Necro, but still relevant, I guess.
@nedbat I just installed this today, running on django 2.0, coverage 4.5.1 and the plugin 1.6.0
My .coveragerc:
[run]
plugins =
django_coverage_plugin
omit =
doc/*
tests/*
setup/wsgi.py
rest_framework/*
It finds no templates at all. I believe this is related to #46
But, pertaining to this particular issue, let's just say I don't know how to use the source=
and include=
options.
I specified source = /app/templates/*
and source = /app/templates/app/*
, both of which resulted in coverage: no data gathered.
Thanks for the feedback.
I'm planning to add documentation on this front. You want the source
to be the source of the project/package which is being tested, not just the template sources.
Take a look at this example .coveragerc
. It's being run by this command. Is that helpful at all? Is the project you're working on available for me to look at? What command are you using to run your tests? What testing tools are you using?
You may also find cookiecutter-django
's config useful.
Based on your suggested .coveragerc
files, I found that include
works while source
still results in no coverage data gathered. I tried , app/ for source, both with same effect. Please note that even include
does not make the templates work, it just doesn't completely fail.
To answer your questions:
- Your first example was not helpful: there was no discernible difference by adding the
[report]
section to my.coveragerc
. - The project is https://github.com/velis74/DynamicForms, but please don't take it too seriously at this stage - we haven't even decided on JavaScript linter yet. It's far from production-ready at this point.
- the command to run tests is
coverage run manage.py test
. Usually I run it from PyCharm though. - No special testing tools: right now we're using standard django (2.0) + DRF (latest) + selenium (latest) and standard django tests. We're not testing JS yet. We just started with django-coverage-plugin to establish groundwork for the templates too. All of this on python 3.6. Regression follows too. We want functionality first.
Got a bit more info: when run on my macbook, it was failing (exception) because debugging django templates was not turned on. Still doesn't work after turning it on though. This exception wasn't raised running on Windows though.
Thanks for all the info! I will have some time to really look into this later this week, and will try to get to the bottom of the behavior you are describing.
Quick Update September 29: Have started poking around on this front and have begun putting some docs together. Will be updating ASAP.