#25510: Putting invalid app name in INSTALLED_APPS makes runserver raise
django.core.exceptions.AppRegistryNotReady
---------------------------------+------------------------------------
Reporter: sephii | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.8
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Comment (by aaugustin):
I tried writing a test for this but it's hard. The following test fails
when the bug is present and hangs when it's fixed:
{{{
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index 4e976d8..fdaaf21 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -1385,6 +1385,21 @@ class
ManageRunserverEmptyAllowedHosts(AdminScriptTestCase):
self.assertOutput(err, 'CommandError: You must set
settings.ALLOWED_HOSTS if DEBUG is False.')
+class ManageRunserverNonExistentApp(AdminScriptTestCase):
+ def setUp(self):
+ self.write_settings('settings.py', apps=['no_such_app'])
+
+ def tearDown(self):
+ self.remove_settings('settings.py')
+
+ def test_non_existent_app_raises_import_error(self):
+ """
+ Ensure that a non-existent app raises an ImportError (#25510).
+ """
+ out, err = self.run_manage(['runserver'])
+ self.assertNoOutput(out)
+ self.assertOutput(err, 'ImportError')
+
class ManageTestserver(AdminScriptTestCase):
from django.core.management.commands.testserver import Command as
TestserverCommand
}}}
I don't want to make a test that depends on a `time.sleep(2)` because it
will be slow and flaky. I don't have a suitable way to detect that
`runserver` has forked a child and is running. I can't run `runserver`
without autoreload because that makes the bug go away.
--
Ticket URL: <https://code.djangoproject.com/ticket/25510#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.a2ac0e7bc160eda96cf88a4ff534d1fa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.