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

need concrete examples of .coveragerc template configuration #19

Open
edwardotis opened this issue Feb 21, 2016 · 7 comments
Open

need concrete examples of .coveragerc template configuration #19

edwardotis opened this issue Feb 21, 2016 · 7 comments

Comments

@edwardotis
Copy link

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.

@nedbat
Copy link
Owner

nedbat commented Feb 21, 2016

@edwardotis can you show what you tried, and what happened?

@PamelaM
Copy link
Collaborator

PamelaM commented Jan 16, 2017

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

@velis74
Copy link

velis74 commented Sep 11, 2018

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.

@jambonrose
Copy link
Collaborator

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.

@velis74
Copy link

velis74 commented Sep 11, 2018

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.

@velis74
Copy link

velis74 commented Sep 16, 2018

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.

@jambonrose
Copy link
Collaborator

jambonrose commented Sep 17, 2018

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.

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

5 participants