unit test cannot be started under Django 2.1

Bug #1789046 reported by Thomas Goirand
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Wishlist
Corey Bryant

Bug Description

Hi,

Building Horizon in Debian Stretch is no problem, and all unit test pass. Unfortunately, under Python 3.7 in Debian Sid, it doesn't even start to run unit tests:

+ http_proxy=127.0.0.1:9 https_proxy=127.0.0.9:9 HTTP_PROXY=127.0.0.1:9 HTTPS_PROXY=127.0.0.1:9 PYTHONPATH=/<<PKGBUILDDIR>>/debian/tmp/usr/lib/python3/dist-packages PYTHON=python3.7 python3.7 -m coverage run /<<PKGBUILDDIR>>/manage.py test -v 2 --settings=horizon.test.settings horizon/test/unit
/usr/lib/python3/dist-packages/scss/selector.py:54: FutureWarning: Possible nested set at position 329
  ''', re.VERBOSE | re.MULTILINE)
/usr/lib/python3/dist-packages/pep8.py:110: FutureWarning: Possible nested set at position 1
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/manage.py", line 25, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python3/dist-packages/django/core/management/commands/test.py", line 26, in run_from_argv
    super().run_from_argv(argv)
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python3/dist-packages/django/core/management/commands/test.py", line 56, in handle
    failures = test_runner.run_tests(test_labels)
  File "/usr/lib/python3/dist-packages/django/test/runner.py", line 605, in run_tests
    self.run_checks()
  File "/usr/lib/python3/dist-packages/django/test/runner.py", line 567, in run_checks
    call_command('check', verbosity=self.verbosity)
  File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 148, in call_command
    return command.execute(*args, **defaults)
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python3/dist-packages/django/core/management/commands/check.py", line 65, in handle
    fail_level=getattr(checks, options['fail_level']),
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 379, in check
    include_deployment_checks=include_deployment_checks,
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 366, in _run_checks
    return checks.run_checks(**kwargs)
  File "/usr/lib/python3/dist-packages/django/core/checks/registry.py", line 71, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/usr/lib/python3/dist-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/usr/lib/python3/dist-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/usr/lib/python3/dist-packages/django/urls/resolvers.py", line 396, in check
    for pattern in self.url_patterns:
  File "/usr/lib/python3/dist-packages/django/utils/functional.py", line 37, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib/python3/dist-packages/django/urls/resolvers.py", line 533, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/lib/python3/dist-packages/django/utils/functional.py", line 37, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib/python3/dist-packages/django/urls/resolvers.py", line 526, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/<<PKGBUILDDIR>>/horizon/test/urls.py", line 36, in <module>
    url(r"auth/login/", views.login, {'template_name': "auth/login.html"},
AttributeError: module 'django.contrib.auth.views' has no attribute 'login'
Creating test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...

Could someone from the Horizon team help me to find the solution? I need this to be fixed in order to have Horizon for Debian Buster.

Revision history for this message
Thomas Goirand (thomas-goirand) wrote :

Hi. While submitting this bug, I understood the problem. As I'm building for Debian Experimental, django 2.1 is being taken from there, instead of Django 1.11 from Sid. And that's the issue: Horizon current has a problem with Django 2.1, not with Python 3.7. So it's still a problem, but not as urgent as I once thought (Buster will be released with Django 1.11). I renamed the title of this bug accordingly.

summary: - unit test cannot be started under Python 3.7
+ unit test cannot be started under Django 2.1
Revision history for this message
Akihiro Motoki (amotoki) wrote :

I am not sure the horizon team has enough development resources to catch up with every Django releases. IMHO, considering the current situation, only Django LTS support might be a candidate.

Note that this bug can be fixed easier.

Changed in horizon:
importance: Undecided → Wishlist
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to horizon (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/596611

Changed in horizon:
assignee: nobody → Akihiro Motoki (amotoki)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/596612

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by Ivan Kolodyazhny (<email address hidden>) on branch: master
Review: https://review.openstack.org/596612
Reason: This review is > 4 months without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Ivan Kolodyazhny (<email address hidden>) on branch: master
Review: https://review.openstack.org/596611
Reason: This review is > 4 months without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to horizon (master)

Reviewed: https://review.openstack.org/596611
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=00c5814313d8af8ff71ed3e8ea9c0883eb3947f4
Submitter: Zuul
Branch: master

commit 00c5814313d8af8ff71ed3e8ea9c0883eb3947f4
Author: Akihiro Motoki <email address hidden>
Date: Mon Aug 27 01:43:40 2018 +0900

    Add py3-dj21 tox env for Django 2.1

    Django 2.1 has been released. It would be nice to have tox env
    for testing with Django 2.1.

    Note that this does not mean I lead Django 2.1 support.

    Related-Bug: #1789046
    Change-Id: Ic5f59e3c19480e01f5bfecbb0994121ee649388f

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by Akihiro Motoki (<email address hidden>) on branch: master
Review: https://review.openstack.org/596612
Reason: I have no plan to work on Django 2.1 support in Stein timeframe.

Akihiro Motoki (amotoki)
Changed in horizon:
assignee: Akihiro Motoki (amotoki) → nobody
status: In Progress → Confirmed
Changed in horizon:
assignee: nobody → Corey Bryant (corey.bryant)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.opendev.org/671045
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=6f4742457fae755e465315f17f39c3977c833d0e
Submitter: Zuul
Branch: master

commit 6f4742457fae755e465315f17f39c3977c833d0e
Author: Corey Bryant <email address hidden>
Date: Tue Jul 16 09:56:48 2019 -0400

    Switch from django string_concat to format_lazy

    string_concat was removed in django 2.1 when it reached the end
    of it's deprecation cycle. It was removed because the same behavior
    can be achieved with format_lazy.

    For more details see:
    https://docs.djangoproject.com/en/2.2/releases/2.1/

    Change-Id: I5e1c9bdfa1d0e049e0516198abbdb76be1667216
    Closes-Bug: #1836671
    Partial-Bug: #1789046

Revision history for this message
Akihiro Motoki (amotoki) wrote :

I believe this has been addressed when we support Django 2.2.

Changed in horizon:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.