Fixed #30872 -- Improved unknown command message when settings are manually configured.
This commit is contained in:
parent
dee687e93a
commit
1de9a92295
|
@ -229,7 +229,7 @@ class ManagementUtility:
|
||||||
# (get_commands() swallows the original one) so the user is
|
# (get_commands() swallows the original one) so the user is
|
||||||
# informed about it.
|
# informed about it.
|
||||||
settings.INSTALLED_APPS
|
settings.INSTALLED_APPS
|
||||||
else:
|
elif not settings.configured:
|
||||||
sys.stderr.write("No Django settings specified.\n")
|
sys.stderr.write("No Django settings specified.\n")
|
||||||
possible_matches = get_close_matches(subcommand, commands)
|
possible_matches = get_close_matches(subcommand, commands)
|
||||||
sys.stderr.write('Unknown command: %r' % subcommand)
|
sys.stderr.write('Unknown command: %r' % subcommand)
|
||||||
|
|
|
@ -634,6 +634,15 @@ class DjangoAdminSettingsDirectory(AdminScriptTestCase):
|
||||||
# of the generated manage.py script
|
# of the generated manage.py script
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
class ManageManullyConfiguredSettings(AdminScriptTestCase):
|
||||||
|
"""Customized manage.py calling settings.configure()."""
|
||||||
|
def test_non_existent_command_output(self):
|
||||||
|
out, err = self.run_manage(['invalid_command'], manage_py='configured_settings_manage.py')
|
||||||
|
self.assertNoOutput(out)
|
||||||
|
self.assertOutput(err, "Unknown command: 'invalid_command'")
|
||||||
|
self.assertNotInOutput(err, 'No Django settings specified')
|
||||||
|
|
||||||
|
|
||||||
class ManageNoSettings(AdminScriptTestCase):
|
class ManageNoSettings(AdminScriptTestCase):
|
||||||
"A series of tests for manage.py when there is no settings.py file."
|
"A series of tests for manage.py when there is no settings.py file."
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue