-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Breaking running of coverage when enabled #29
Comments
@clokep: Sorry things are going badly. I haven't had time to work on the Django template plugin in quite a while, and it might be a while before I do. What I'd really like is to find someone else to take it over... :( |
@clokep: Could you try the latest version (https://pypi.python.org/pypi/django_coverage_plugin/1.4)? I'm not sure it will solve your problem, but if your problem is related to #28, then it might. |
@PamelaM First, thanks for taking a look at this! 👍 This seems to have fixed the issue of coverage erroring immediately when running, but unfortunately I don't seem to have any coverage of the templates! (I can run I'm getting the following warning when I run coverage:
I tried this quickly in a Django shell and TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [normpath(join(DJANGO_ROOT, 'templates'))],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
# + a few custom ones.
],
'debug': DEBUG,
},
},
] Any idea what's happening here? Thanks again! |
Hi, this is a chicken-and-egg problem with settings configuration-and
template loading that I think is masked by the the django_coverage_plugin
test environment (initialization order stuff is always hard to test).
I've got a reproducible case and I'm working on it - but it's prioritized
behind a couple of other commitments. Hopefully this weekend for a fix to
this problem and later I'll update the dj-c-p test framework to include a
stand-alone test_project to provide for some cleaner integration tests.
pam
…On Tue, Jan 17, 2017 at 9:49 AM, Patrick Cloke ***@***.***> wrote:
@PamelaM <https://github.com/PamelaM> First, thanks for taking a look at
this! 👍
This seems to have fixed the issue of coverage erroring immediately when
running, but unfortunately I don't seem to have any coverage of the
templates! (I can run coverage and get a coverage report, including the
template files, but it doesn't seem to have actually processed these files.)
I'm getting the following warning when I run coverage:
coverage run manage.py test
Coverage.py warning: Disabling plugin 'django_coverage_plugin.DjangoTemplatePlugin' due to an exception:
Traceback (most recent call last):
File "/usr/local/venv/local/lib/python2.7/site-packages/coverage/control.py", line 476, in _should_trace_internal
file_tracer = plugin.file_tracer(canonical)
File "/usr/local/venv/local/lib/python2.7/site-packages/django_coverage_plugin/plugin.py", line 158, in file_tracer
self.debug_checked = check_debug()
File "/usr/local/venv/local/lib/python2.7/site-packages/django_coverage_plugin/plugin.py", line 56, in check_debug
if not hasattr(django.template.backends, "django"):
AttributeError: 'module' object has no attribute 'backends'
I tried this quickly in a Django shell and django.template DOES have an
attribute backends. My settings look like:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [normpath(join(DJANGO_ROOT, 'templates'))],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
# + a few custom ones.
],
'debug': DEBUG,
},
},
]
Any idea what's happening here? Thanks again!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAz1vTXlJADqDGl8sfni5c5qyEtNAAJSks5rTNUHgaJpZM4LXn8R>
.
--
Pamela McA'Nulty
Senior Director, Software Engineering
75 Sidney Street, Suite 550A
Cambridge, MA 02139
direct: 617-245-2576
office: 617-225-9000
www.addgene.org
Love Addgene? Follow us: Facebook <https://www.facebook.com/addgene> |
Twitter <https://twitter.com/Addgene> | LinkedIn
<https://www.linkedin.com/company/addgene> | Blog
<http://blog.addgene.org/>
|
Awesome! Let me know if you want help testing a branch or anything! 👍 |
@clokep I've merged a fix for the most common likely problems. Could you try out the master branch and see if there are any surprises? |
💥 That worked! Seems like this was fixed by #33. Thanks so much for the help! |
First, thanks for this great plug-in! I've found it quite useful for testing some of the logic in my templates. 👍
I know this used to work in my project, but I'm not sure when it broke. (I don't think this has updated in a while, it could have been a Django update that broke this?)
My project is using Django 1.10.4, coverage 4.3.1, django-coverage-plugin 1.3.1. (I also tried with coverage 4.2, that exhibited the same behavior.)
While running with this I'm getting a stack trace:
This seems to be because I'm importing
django.contrib.messages.constants
in my settings file, note that if I remove this line I get other errors about importing. This seems related to loading of Django settings before Django is configured (see #28 (comment)), but with much worse consequences.Let me know if there is anything I can do to help confirm my suspicion or narrow this down! Thanks.
The text was updated successfully, but these errors were encountered: