[openstack-dev] [horizon] Support for Django 1.7: there's a bit of work, though it looks fixable to me...

Thomas Goirand zigo at debian.org
Sun Aug 3 10:55:19 UTC 2014


The Debian maintainer of Django would like to upload Django 1.7 before
Jessie is frozen on the 5th of November. As for OpenStack, I would like
Icehouse to be in Jessie, since it will be supported by major companies
(RedHat and Canonical both will use Icehouse as LTS, and will work on
security for a longer time than previously planned in the OpenStack

Though Horizon Icehouse doesn't currently work with Django 1.7. The
first thing to fix would be the TEMPLATE_DIRS thing:

./run_tests.sh -N -P || true
Running Horizon application tests
Traceback (most recent call last):
line 25, in <module>
line 385, in execute_from_command_line
[... not useful stack dump ...]
  File "/usr/lib/python2.7/dist-packages/django/conf/__init__.py", line
42, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/lib/python2.7/dist-packages/django/conf/__init__.py", line
110, in __init__
    "Please fix your settings." % setting)
django.core.exceptions.ImproperlyConfigured: The TEMPLATE_DIRS setting
must be a tuple. Please fix your settings.
Running openstack_dashboard tests
WARNING:root:No local_settings file found.

Then of course, the rest of the tests are completely broken because
there's no local_settings. Adding a comma at the end of:

TEMPLATE_DIRS = (os.path.join(ROOT_PATH, 'tests', 'templates'))

in horizon/test/settings.py fixes the issue. Note that this works in
both Django 1.6 and 1.7. Some other TEMPLATE_DIRS declaration already
have the comma, so I guess it's fine to add it. Which is why I did this:

FYI, there's this document that talks about it:

Then, after fixing this, I get this error:
ERROR: Failure: TypeError (Error when calling the metaclass bases
    function() argument 1 must be code, not str)
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 414, in
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in
    mod = load_module(part_fqname, fh, filename, desc)
line 28, in <module>
    from horizon.test import helpers as test
line 184, in <module>
    class JasmineTests(SeleniumTestCase):
TypeError: Error when calling the metaclass bases
    function() argument 1 must be code, not str

There's the same issue in the definition of SeleniumTestCase() in
openstack_dashboard/test/helpers.py (line 365 in Icehouse).

Since I don't really care about selenium (it can't be tested in Debian
because it's non-free), I commented out the class
JasmineTests(SeleniumTestCase), then I get more errors. A few instances
of this one:

line 206, in <lambda>
    "average": lambda data: sum(data, 0.0) / len(data)
TypeError: unsupported operand type(s) for +: 'float' and 'str'

I'm not a Django expert, so I it'd be awesome to get help on this. Best
would be that:
1/ Support for Django 1.7 is added to Juno
2/ The changes are backported to Icehouse (even if this doesn't make it
into the stable branch because of "let's stay safe", I can add the
patches as Debian specific).

Thoughts from the Horizon team would be welcome.


Thomas Goirand (zigo)

More information about the OpenStack-dev mailing list