You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Version 1.4 seems to break when django.templates.backends has not been initialized #32
Coverage.py warning: Disabling plugin 'django_coverage_plugin.DjangoTemplatePlugin' due to an exception:
Traceback (most recent call last):
File "/home/teamcity/.virtualenvs/addgene1.8/local/lib/python2.7/site-packages/coverage/control.py", line 476, in _should_trace_internal
file_tracer = plugin.file_tracer(canonical)
File "/home/teamcity/.virtualenvs/addgene1.8/local/lib/python2.7/site-packages/django_coverage_plugin/plugin.py", line 158, in file_tracer
self.debug_checked = check_debug()
File "/home/teamcity/.virtualenvs/addgene1.8/local/lib/python2.7/site-packages/django_coverage_plugin/plugin.py", line 56, in check_debug
if not hasattr(django.template.backends, "django"):
I'll work though a fix PR in the next two days.
Because of the chicken-and-egg issues of starting, I think the need for a test_project that can be used for full integration testing via subprocess calls is even more vital. There are too many "shenanigans" involved with getting coverage/django startup initialization order reversed and re-run during the current test process.
I just wanted to add that we've just recently started to experience this issue...
(backend) [17:43:43] gary:backend git:(dev*) $ coverage run ./manage.py test -v 2
Coverage.py warning: Disabling plugin 'django_coverage_plugin.DjangoTemplatePlugin' due to an exception:
Traceback (most recent call last):
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/coverage/control.py", line 476, in _should_trace_internal
file_tracer = plugin.file_tracer(canonical)
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/django_coverage_plugin/plugin.py", line 158, in file_tracer
self.debug_checked = check_debug()
File "/home/gary/dev/envs/backend/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'
@PamelaM Thank you for getting back to me, I appreciate your response.
Since upgrading to django-coverage-plugin==1.4.1 we're now experiencing the following issue.
(backend) [8:55:09] gary:backend git:(dev*) $ pip freeze | grep coverage
coverage==4.3.4
django-coverage-plugin==1.4.1
(backend) [8:55:14] gary:backend git:(dev*) $ coverage run ./manage.py test -v 2
Coverage.py warning: Disabling plugin 'django_coverage_plugin.DjangoTemplatePlugin' due to an exception:
Traceback (most recent call last):
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/coverage/control.py", line 476, in _should_trace_internal
file_tracer = plugin.file_tracer(canonical)
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/django_coverage_plugin/plugin.py", line 163, in file_tracer
self.debug_checked = check_debug()
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/django_coverage_plugin/plugin.py", line 67, in check_debug
for engine in django.template.engines.all():
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/django/template/utils.py", line 110, in all
return [self[alias] for alias in self]
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/django/template/utils.py", line 101, in __getitem__
engine = engine_cls(params)
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/django/template/backends/django.py", line 31, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/django/template/backends/django.py", line 49, in get_templatetag_libraries
libraries = get_installed_libraries()
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/django/template/backends/django.py", line 132, in get_installed_libraries
for app_config in apps.get_app_configs())
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/django/apps/registry.py", line 137, in get_app_configs
self.check_apps_ready()
File "/home/gary/dev/envs/backend/local/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
AppRegistryNotReady: Apps aren't loaded yet.
Unfortunately it seems as if our best option at this point is to downgrade to django-coverage-plugin==1.3.1
I'll keep plugging away this weekend. I can see where you're getting the error, now I just need to figure out what my integration test environment is doing differently than your environment (since I'm not getting that error).
It's probably time to step back and rethink every part of the startup process. I'll probably also remove support for DJ 1.7 and earlier - if only to simplify the plugin.
Clearly, there are a number of variables. I see that you're running "Python==2.7.(something)". I'll assume you're still on "Django==1.9" and focus on that.
Any idea how I would be able to pull in that PR through pip? I have tried the following command with your PR commit pip install git+http://github.com/nedbat/django_coverage_plugin.git@4df203a0908ac638f6c6da2b2e53096eb29506e8 with no luck.
Activity
PamelaM commentedon Jan 19, 2017
I can only reproduce it in one case where we're not using a management command, so this doesn't look like a complete show-stopper. Still looking at it
ambivalentno commentedon Jan 19, 2017
I observe such behavior even if running with
coverage run manage.py test(Django 1.6 project migrating to 1.8)jclgoodwin commentedon Jan 21, 2017
I've also observed such behaviour running with
coverage run manage.py test(Django 1.10 project). But #33 fixes the problem for me 👍garyayo commentedon Jan 25, 2017
I just wanted to add that we've just recently started to experience this issue...
We're currently running:
Any idea how we can resolve this issue and move forward?
Thanks
PamelaM commentedon Jan 26, 2017
Ned just released
django-coverage-plugin==1.4.1which should address the problems dealing wit deferred initialization of the backends.Please check it out and let us know if it works for you.
garyayo commentedon Jan 26, 2017
@PamelaM Thank you for getting back to me, I appreciate your response.
Since upgrading to
django-coverage-plugin==1.4.1we're now experiencing the following issue.Unfortunately it seems as if our best option at this point is to downgrade to
django-coverage-plugin==1.3.1PamelaM commentedon Jan 26, 2017
I'll keep plugging away this weekend. I can see where you're getting the error, now I just need to figure out what my integration test environment is doing differently than your environment (since I'm not getting that error).
It's probably time to step back and rethink every part of the startup process. I'll probably also remove support for DJ 1.7 and earlier - if only to simplify the plugin.
Clearly, there are a number of variables. I see that you're running "Python==2.7.(something)". I'll assume you're still on "Django==1.9" and focus on that.
garyayo commentedon Jan 26, 2017
Thanks @PamelaM.
You're correct. The error is occurring within our backend environment which is setup as
Thanks again. Please let me know if you need any additional information.
PamelaM commentedon Jan 31, 2017
@garyayo Could you try with PR #38?
I think the fix will address both your issue and a number of other, similar ones.
Please let me know if it works for you.
Thanks
Pam
garyayo commentedon Feb 2, 2017
@PamelaM Sorry for the delay in my response.
Any idea how I would be able to pull in that PR through pip? I have tried the following command with your PR commit
pip install git+http://github.com/nedbat/django_coverage_plugin.git@4df203a0908ac638f6c6da2b2e53096eb29506e8with no luck.Would love to test out that PR for you.
clokep commentedon Feb 2, 2017
@garyayo Use the following:
pip install https://codeload.github.com/nedbat/django_coverage_plugin/zip/4df203a0908ac638f6c6da2b2e53096eb29506e8Note that if you already have django-coverage-plugin 1.4.1 installed pip won't upgrade to the new code because it's the same version number.
garyayo commentedon Feb 2, 2017
Very excellent! Thank you @clokep!
@PamelaM I've very happy to say that my issue appears to have been resolved!
Thanks for all the hard work.
PamelaM commentedon Feb 7, 2017
Excellent! Thanks for checking!
PamelaM commentedon Feb 7, 2017
Fixed by version 1.4.2