Merge pull request #2217 from edbrannin/patch-1

shorten output when ImportError due to app bug.
This commit is contained in:
David Lord 2017-03-24 08:59:00 -07:00 committed by GitHub
commit 19d7e6532f
2 changed files with 4 additions and 2 deletions

View file

@ -93,7 +93,9 @@ def locate_app(app_id):
# Reraise the ImportError if it occurred within the imported module.
# Determine this by checking whether the trace has a depth > 1.
if sys.exc_info()[-1].tb_next:
raise
stack_trace = traceback.format_exc()
raise NoAppException('There was an error trying to import'
' the app (%s):\n%s' % (module, stack_trace))
else:
raise NoAppException('The file/path provided (%s) does not appear'
' to exist. Please verify the path is '

View file

@ -83,7 +83,7 @@ def test_locate_app(test_apps):
pytest.raises(NoAppException, locate_app, "notanpp.py")
pytest.raises(NoAppException, locate_app, "cliapp/app")
pytest.raises(RuntimeError, locate_app, "cliapp.app:notanapp")
pytest.raises(ImportError, locate_app, "cliapp.importerrorapp")
pytest.raises(NoAppException, locate_app, "cliapp.importerrorapp")
def test_find_default_import_path(test_apps, monkeypatch, tmpdir):