DEP8 failure: "Apps aren't loaded yet"

Bug #2050093 reported by Andreas Hasenack
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-django-bootstrap-form (Ubuntu)
Fix Released
Undecided
Andreas Hasenack

Bug Description

From https://autopkgtest.ubuntu.com/results/autopkgtest-noble/noble/arm64/p/python-django-bootstrap-form/20240123_060318_1ab8b@/log.gz

(...)
344s autopkgtest [06:02:28]: test command1: python3 runtests.py
344s autopkgtest [06:02:28]: test command1: [-----------------------
344s /tmp/autopkgtest.LCD785/build.iLk/src/runtests.py:61: RemovedInDjango50Warning: The extra_tests argument is deprecated.
344s failures = test_runner.run_tests(['bootstrapform'], test_args)
344s Found 1 test(s).
344s Traceback (most recent call last):
344s File "/tmp/autopkgtest.LCD785/build.iLk/src/runtests.py", line 66, in <module>
344s runtests(*sys.argv[1:])
344s File "/tmp/autopkgtest.LCD785/build.iLk/src/runtests.py", line 61, in runtests
344s failures = test_runner.run_tests(['bootstrapform'], test_args)
344s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
344s File "/usr/lib/python3/dist-packages/django/test/runner.py", line 1060, in run_tests
344s self.run_checks(databases)
344s File "/usr/lib/python3/dist-packages/django/test/runner.py", line 977, in run_checks
344s call_command("check", verbosity=self.verbosity, databases=databases)
344s File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 110, in call_command
344s app_name = get_commands()[command_name]
344s ^^^^^^^^^^^^^^
344s File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 76, in get_commands
344s for app_config in reversed(apps.get_app_configs()):
344s ^^^^^^^^^^^^^^^^^^^^^^
344s File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 147, in get_app_configs
344s self.check_apps_ready()
344s File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 138, in check_apps_ready
344s raise AppRegistryNotReady("Apps aren't loaded yet.")
344s django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hm, that's not it.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

/usr/lib/python3/dist-packages/bootstrapform/meta.py comes from src:python-django-bootstrap-form, changing package

affects: freedombox (Ubuntu) → python-django-bootstrap-form (Ubuntu)
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Testing a patch. I'm working on this because it came up in the samba migration in noble (freedombox, a reverse DEP8 dependency, started failing).

Changed in python-django-bootstrap-form (Ubuntu):
assignee: nobody → Andreas Hasenack (ahasenack)
status: New → In Progress
tags: added: server-todo
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I fixed the StrictVersion import, but the tests are failing[1] with python 3.12 even without my patch due to something else.

1. https://autopkgtest.ubuntu.com/results/autopkgtest-noble/noble/arm64/p/python-django-bootstrap-form/20240123_060318_1ab8b@/log.gz

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Just in case the DEP8 log gets wiped, this is the error:
344s autopkgtest [06:02:28]: test command1: python3 runtests.py
344s autopkgtest [06:02:28]: test command1: [-----------------------
344s /tmp/autopkgtest.LCD785/build.iLk/src/runtests.py:61: RemovedInDjango50Warning: The extra_tests argument is deprecated.
344s failures = test_runner.run_tests(['bootstrapform'], test_args)
344s Found 1 test(s).
344s Traceback (most recent call last):
344s File "/tmp/autopkgtest.LCD785/build.iLk/src/runtests.py", line 66, in <module>
344s runtests(*sys.argv[1:])
344s File "/tmp/autopkgtest.LCD785/build.iLk/src/runtests.py", line 61, in runtests
344s failures = test_runner.run_tests(['bootstrapform'], test_args)
344s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
344s File "/usr/lib/python3/dist-packages/django/test/runner.py", line 1060, in run_tests
344s self.run_checks(databases)
344s File "/usr/lib/python3/dist-packages/django/test/runner.py", line 977, in run_checks
344s call_command("check", verbosity=self.verbosity, databases=databases)
344s File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 110, in call_command
344s app_name = get_commands()[command_name]
344s ^^^^^^^^^^^^^^
344s File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 76, in get_commands
344s for app_config in reversed(apps.get_app_configs()):
344s ^^^^^^^^^^^^^^^^^^^^^^
344s File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 147, in get_app_configs
344s self.check_apps_ready()
344s File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 138, in check_apps_ready
344s raise AppRegistryNotReady("Apps aren't loaded yet.")
344s django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

summary: - DEP8 failure due to distutils import
+ DEP8 failure: "Apps aren't loaded yet"
description: updated
Changed in python-django-bootstrap-form (Ubuntu):
assignee: Andreas Hasenack (ahasenack) → nobody
assignee: nobody → Andreas Hasenack (ahasenack)
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

So I thought, and verified it locally, that the problem was that the test ran with an unpatched test suite. The package has a patch for django 4 which also touches the tests. If I run the tests in an unpatched source, I get the same failure.

So I added the "build-needed" restriction to the test in d/t/control, and great, test passed locally. Uploaded to PPA, and it didn't. My last attempt was to verify that the runtests.py file that the DEP8 test was about to run was indeed the patched one, and it was.

¯\_(ツ)_/¯

Time to sleep on it.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Download full text (3.9 KiB)

Log:
621s autopkgtest [15:20:33]: test command1: cat runtests.py; python3 runtests.py
621s autopkgtest [15:20:33]: test command1: [-----------------------
621s #!/usr/bin/env python
621s
621s import sys
621s import django
621s from os.path import dirname, abspath
621s
621s from django.conf import settings
621s
621s settings.configure(
621s DATABASES = {
621s 'default': {
621s 'ENGINE': 'django.db.backends.sqlite3',
621s 'NAME': ':memory:'
621s }
621s },
621s INSTALLED_APPS=[
621s 'django.contrib.auth',
621s 'django.contrib.contenttypes',
621s 'django.contrib.sessions',
621s 'django.contrib.sites',
621s 'bootstrapform',
621s ],
621s MIDDLEWARE = (
621s 'django.contrib.sessions.middleware.SessionMiddleware',
621s 'django.middleware.common.CommonMiddleware',
621s 'django.middleware.csrf.CsrfViewMiddleware',
621s 'django.contrib.auth.middleware.AuthenticationMiddleware',
621s 'django.contrib.messages.middleware.MessageMiddleware',
621s 'django.middleware.clickjacking.XFrameOptionsMiddleware',
621s ),
621s SITE_ID=1,
621s DEBUG=False,
621s ROOT_URLCONF='',
621s TEMPLATES = [ # For >= Django 1.10
621s {
621s 'BACKEND': 'django.template.backends.django.DjangoTemplates',
621s 'APP_DIRS': True,
621s 'OPTIONS': {
621s 'context_processors': [
621s 'django.contrib.auth.context_processors.auth',
621s ],
621s },
621s },
621s ],
621s )
621s
621s
621s def runtests(**test_args):
621s from django.test.utils import get_runner
621s
621s parent = dirname(abspath(__file__))
621s sys.path.insert(0, parent)
621s
621s try:
621s django.setup()
621s except:
621s pass
621s
621s TestRunner = get_runner(settings)
621s test_runner = TestRunner(verbosity=1, interactive=True)
621s failures = test_runner.run_tests(['bootstrapform'], test_args)
621s sys.exit(failures)
621s
621s
621s if __name__ == '__main__':
621s runtests(*sys.argv[1:])
622s /tmp/autopkgtest.jexV0O/build.cZx/src/runtests.py:61: RemovedInDjango50Warning: The extra_tests argument is deprecated.
622s failures = test_runner.run_tests(['bootstrapform'], test_args)
622s Found 1 test(s).
622s Traceback (most recent call last):
622s File "/tmp/autopkgtest.jexV0O/build.cZx/src/runtests.py", line 66, in <module>
622s runtests(*sys.argv[1:])
622s File "/tmp/autopkgtest.jexV0O/build.cZx/src/runtests.py", line 61, in runtests
622s failures = test_runner.run_tests(['bootstrapform'], test_args)
622s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
622s File "/usr/lib/python3/dist-packages/django/test/runner.py", line 1060, in run_tests
622s self.run_checks(databases)
622s File "/usr/lib/python3/dist-packages/django/test/runner.py", line 977, in run_checks
622s call_command("check", verbosity=self.verbosity, databases=databases)
622s File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 110, in call_command...

Read more...

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Changed in python-django-bootstrap-form (Ubuntu):
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.