Ticket #10706: t10706.diff

File t10706.diff, 6.0 KB (added by Dennis Kaarsemaker, 15 years ago)

Make the error message clearer

  • tests/regressiontests/admin_scripts/tests.py

     
    337337        args = ['sqlall','--settings=settings', 'admin_scripts']
    338338        out, err = self.run_django_admin(args)
    339339        self.assertNoOutput(out)
    340         self.assertOutput(err, 'App with label admin_scripts could not be found')
     340        self.assertOutput(err, 'App with label admin_scripts could not be found or caused an error during import')
    341341
    342342    def test_builtin_with_environment(self):
    343343        "minimal: django-admin builtin commands fail if settings are provided in the environment"
    344344        args = ['sqlall','admin_scripts']
    345345        out, err = self.run_django_admin(args,'settings')
    346346        self.assertNoOutput(out)
    347         self.assertOutput(err, 'App with label admin_scripts could not be found')
     347        self.assertOutput(err, 'App with label admin_scripts could not be found or caused an error during import')
    348348
    349349    def test_builtin_with_bad_settings(self):
    350350        "minimal: django-admin builtin commands fail if settings file (from argument) doesn't exist"
     
    760760        args = ['sqlall','admin_scripts']
    761761        out, err = self.run_manage(args)
    762762        self.assertNoOutput(out)
    763         self.assertOutput(err, 'App with label admin_scripts could not be found')
     763        self.assertOutput(err, 'App with label admin_scripts could not be found or caused an error during import')
    764764
    765765    def test_builtin_with_settings(self):
    766766        "minimal: manage.py builtin commands fail if settings are provided as argument"
    767767        args = ['sqlall','--settings=settings', 'admin_scripts']
    768768        out, err = self.run_manage(args)
    769769        self.assertNoOutput(out)
    770         self.assertOutput(err, 'App with label admin_scripts could not be found')
     770        self.assertOutput(err, 'App with label admin_scripts could not be found or caused an error during import')
    771771
    772772    def test_builtin_with_environment(self):
    773773        "minimal: manage.py builtin commands fail if settings are provided in the environment"
    774774        args = ['sqlall','admin_scripts']
    775775        out, err = self.run_manage(args,'settings')
    776776        self.assertNoOutput(out)
    777         self.assertOutput(err, 'App with label admin_scripts could not be found')
     777        self.assertOutput(err, 'App with label admin_scripts could not be found or caused an error during import')
    778778
    779779    def test_builtin_with_bad_settings(self):
    780780        "minimal: manage.py builtin commands fail if settings file (from argument) doesn't exist"
     
    788788        args = ['sqlall','admin_scripts']
    789789        out, err = self.run_manage(args,'bad_settings')
    790790        self.assertNoOutput(out)
    791         self.assertOutput(err, 'App with label admin_scripts could not be found')
     791        self.assertOutput(err, 'App with label admin_scripts could not be found or caused an error during import')
    792792
    793793    def test_custom_command(self):
    794794        "minimal: manage.py can't execute user commands without appropriate settings"
     
    897897        args = ['sqlall','admin_scripts']
    898898        out, err = self.run_manage(args)
    899899        self.assertNoOutput(out)
    900         self.assertOutput(err, 'App with label admin_scripts could not be found.')
     900        self.assertOutput(err, 'App with label admin_scripts could not be found or caused an error during import.')
    901901
    902902    def test_builtin_with_settings(self):
    903903        "multiple: manage.py builtin commands succeed if settings are provided as argument"
     
    912912        args = ['sqlall','admin_scripts']
    913913        out, err = self.run_manage(args,'alternate_settings')
    914914        self.assertNoOutput(out)
    915         self.assertOutput(err, 'App with label admin_scripts could not be found.')
     915        self.assertOutput(err, 'App with label admin_scripts could not be found or caused an error during import.')
    916916
    917917    def test_builtin_with_bad_settings(self):
    918918        "multiple: manage.py builtin commands fail if settings file (from argument) doesn't exist"
     
    926926        args = ['sqlall','admin_scripts']
    927927        out, err = self.run_manage(args,'bad_settings')
    928928        self.assertNoOutput(out)
    929         self.assertOutput(err, "App with label admin_scripts could not be found")
     929        self.assertOutput(err, "App with label admin_scripts could not be found or caused an error during import")
    930930
    931931    def test_custom_command(self):
    932932        "multiple: manage.py can't execute user commands using default settings"
     
    10671067        "User AppCommands can execute when a single app name is provided"
    10681068        args = ['app_command', 'NOT_AN_APP']
    10691069        out, err = self.run_manage(args)
    1070         self.assertOutput(err, "App with label NOT_AN_APP could not be found")
     1070        self.assertOutput(err, "App with label NOT_AN_APP could not be found or caused an error during import")
    10711071
    10721072    def test_app_command_some_invalid_appnames(self):
    10731073        "User AppCommands can execute when some of the provided app names are invalid"
    10741074        args = ['app_command', 'auth', 'NOT_AN_APP']
    10751075        out, err = self.run_manage(args)
    1076         self.assertOutput(err, "App with label NOT_AN_APP could not be found")
     1076        self.assertOutput(err, "App with label NOT_AN_APP could not be found or caused an error during import")
    10771077
    10781078    def test_label_command(self):
    10791079        "User LabelCommands can execute when a label is provided"
  • django/db/models/loading.py

     
    122122                            return None
    123123                    else:
    124124                        return mod
    125             raise ImproperlyConfigured, "App with label %s could not be found" % app_label
     125            raise ImproperlyConfigured, "App with label %s could not be found or caused an error during import" % app_label
    126126        finally:
    127127            self.write_lock.release()
    128128
Back to Top