Actions
Issue #2257
closedunit test failure: "AppRegistryNotReady: Apps aren't loaded yet."
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Master
Platform Release:
2.10.1
OS:
Fedora 24
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Sprint 8
Quarter:
Description
It appears that django 1.9 (which is in F24) changed some behavior and now requires that django.setup() gets called before using the Template object in a stand-alone use case.
It's documented as a requirement even for 1.8, but that hasn't prevented our tests from working until 1.9.
These are the test failures:
======================================================================
ERROR: test_render_filelists (test.unit.plugins.db.test_models.TestRpmBaseRender)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vagrant/devel/pulp_rpm/plugins/test/unit/plugins/db/test_models.py", line 1124, in test_render_filelists
ret = self.unit.render_filelists('sha1')
File "/home/vagrant/devel/pulp_rpm/plugins/pulp_rpm/plugins/db/models.py", line 802, in render_filelists
return self._render(metadata, context)
File "/home/vagrant/devel/pulp_rpm/plugins/pulp_rpm/plugins/db/models.py", line 817, in _render
t = Template(template)
File "/usr/lib/python2.7/site-packages/django/template/base.py", line 182, in __init__
engine = Engine.get_default()
File "/usr/lib/python2.7/site-packages/django/utils/lru_cache.py", line 124, in wrapper
result = user_function(*args, **kwds)
File "/usr/lib/python2.7/site-packages/django/template/engine.py", line 88, in get_default
django_engines = [engine for engine in engines.all()
File "/usr/lib/python2.7/site-packages/django/template/utils.py", line 110, in all
return [self[alias] for alias in self]
File "/usr/lib/python2.7/site-packages/django/template/utils.py", line 101, in __getitem__
engine = engine_cls(params)
File "/usr/lib/python2.7/site-packages/django/template/backends/django.py", line 31, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "/usr/lib/python2.7/site-packages/django/template/backends/django.py", line 49, in get_templatetag_libraries
libraries = get_installed_libraries()
File "/usr/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 "/usr/lib/python2.7/site-packages/django/apps/registry.py", line 137, in get_app_configs
self.check_apps_ready()
File "/usr/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.
======================================================================
ERROR: test_render_other (test.unit.plugins.db.test_models.TestRpmBaseRender)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vagrant/devel/pulp_rpm/plugins/test/unit/plugins/db/test_models.py", line 1129, in test_render_other
ret = self.unit.render_other('sha1')
File "/home/vagrant/devel/pulp_rpm/plugins/pulp_rpm/plugins/db/models.py", line 788, in render_other
return self._render(metadata, context)
File "/home/vagrant/devel/pulp_rpm/plugins/pulp_rpm/plugins/db/models.py", line 817, in _render
t = Template(template)
File "/usr/lib/python2.7/site-packages/django/template/base.py", line 182, in __init__
engine = Engine.get_default()
File "/usr/lib/python2.7/site-packages/django/utils/lru_cache.py", line 124, in wrapper
result = user_function(*args, **kwds)
File "/usr/lib/python2.7/site-packages/django/template/engine.py", line 88, in get_default
django_engines = [engine for engine in engines.all()
File "/usr/lib/python2.7/site-packages/django/template/utils.py", line 110, in all
return [self[alias] for alias in self]
File "/usr/lib/python2.7/site-packages/django/template/utils.py", line 101, in __getitem__
engine = engine_cls(params)
File "/usr/lib/python2.7/site-packages/django/template/backends/django.py", line 31, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "/usr/lib/python2.7/site-packages/django/template/backends/django.py", line 49, in get_templatetag_libraries
libraries = get_installed_libraries()
File "/usr/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 "/usr/lib/python2.7/site-packages/django/apps/registry.py", line 137, in get_app_configs
self.check_apps_ready()
File "/usr/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.
======================================================================
ERROR: test_render_primary (test.unit.plugins.db.test_models.TestRpmBaseRender)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vagrant/devel/pulp_rpm/plugins/test/unit/plugins/db/test_models.py", line 1134, in test_render_primary
ret = self.unit.render_primary('sha1')
File "/home/vagrant/devel/pulp_rpm/plugins/pulp_rpm/plugins/db/models.py", line 772, in render_primary
return self._render(metadata, context)
File "/home/vagrant/devel/pulp_rpm/plugins/pulp_rpm/plugins/db/models.py", line 817, in _render
t = Template(template)
File "/usr/lib/python2.7/site-packages/django/template/base.py", line 182, in __init__
engine = Engine.get_default()
File "/usr/lib/python2.7/site-packages/django/utils/lru_cache.py", line 124, in wrapper
result = user_function(*args, **kwds)
File "/usr/lib/python2.7/site-packages/django/template/engine.py", line 88, in get_default
django_engines = [engine for engine in engines.all()
File "/usr/lib/python2.7/site-packages/django/template/utils.py", line 110, in all
return [self[alias] for alias in self]
File "/usr/lib/python2.7/site-packages/django/template/utils.py", line 101, in __getitem__
engine = engine_cls(params)
File "/usr/lib/python2.7/site-packages/django/template/backends/django.py", line 31, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "/usr/lib/python2.7/site-packages/django/template/backends/django.py", line 49, in get_templatetag_libraries
libraries = get_installed_libraries()
File "/usr/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 "/usr/lib/python2.7/site-packages/django/apps/registry.py", line 137, in get_app_configs
self.check_apps_ready()
File "/usr/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.
----------------------------------------------------------------------
Actions
Adds a required django.setup() call to unit tests.
Some unit tests failed under django 1.9 without this setup call.
https://pulp.plan.io/issues/2257 fixes #2257