diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-09-26 15:07:11 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-09-26 15:07:11 +0200 |
| commit | bb7da7844ff9f11286509c22a2549bbd4553d58d (patch) | |
| tree | 157b402708bfe1fbb4db9e78ac5035c9e164d6aa /tests/regressiontests/admin_scripts/tests.py | |
| parent | 2c8267bf3db608b99c04ae903c424b60cafaaf93 (diff) | |
Fixed #18845 -- Do not swallow AttributeErrors when running commands
Diffstat (limited to 'tests/regressiontests/admin_scripts/tests.py')
| -rw-r--r-- | tests/regressiontests/admin_scripts/tests.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/regressiontests/admin_scripts/tests.py b/tests/regressiontests/admin_scripts/tests.py index 6028eac846..6f524bea29 100644 --- a/tests/regressiontests/admin_scripts/tests.py +++ b/tests/regressiontests/admin_scripts/tests.py @@ -982,13 +982,11 @@ class ManageMultipleSettings(AdminScriptTestCase): self.assertNoOutput(err) self.assertOutput(out, "EXECUTE:NoArgsCommand") + class ManageSettingsWithImportError(AdminScriptTestCase): """Tests for manage.py when using the default settings.py file with an import error. Ticket #14130. """ - def setUp(self): - self.write_settings_with_import_error('settings.py') - def tearDown(self): self.remove_settings('settings.py') @@ -1004,12 +1002,27 @@ class ManageSettingsWithImportError(AdminScriptTestCase): settings_file.write('# The next line will cause an import error:\nimport foo42bar\n') def test_builtin_command(self): - "import error: manage.py builtin commands shows useful diagnostic info when settings with import errors is provided" + """ + import error: manage.py builtin commands shows useful diagnostic info + when settings with import errors is provided + """ + self.write_settings_with_import_error('settings.py') args = ['sqlall', 'admin_scripts'] out, err = self.run_manage(args) self.assertNoOutput(out) self.assertOutput(err, "No module named foo42bar") + def test_builtin_command_with_attribute_error(self): + """ + manage.py builtin commands does not swallow attribute errors from bad settings (#18845) + """ + self.write_settings('settings.py', sdict={'BAD_VAR': 'INSTALLED_APPS.crash'}) + args = ['collectstatic', 'admin_scripts'] + out, err = self.run_manage(args) + self.assertNoOutput(out) + self.assertOutput(err, "AttributeError: 'list' object has no attribute 'crash'") + + class ManageValidate(AdminScriptTestCase): def tearDown(self): self.remove_settings('settings.py') |
