cleaner message when CLI can't load app
When loading the app fails for the --help command, only the error message is shown, then the help text. The full traceback is shown for other exceptions. Also show the message when loading fails while getting a command, instead of only "command not found". The error message goes to stderr to match other error behavior, and is in red with an extra newline to make it more obvious next to the help text. Also fixes an issue with the test_apps fixture that caused an imported app to still be importable after the test was over and the path was reset. Now the module cache is reset as well.
This commit is contained in:
parent
fd0a608449
commit
253570784c
4 changed files with 59 additions and 38 deletions
|
|
@ -12,6 +12,8 @@ Unreleased
|
|||
- Passing ``script_info`` to app factory functions is deprecated. This
|
||||
was not portable outside the ``flask`` command. Use
|
||||
``click.get_current_context().obj`` if it's needed. :issue:`3552`
|
||||
- The CLI shows better error messages when the app failed to load
|
||||
when looking up commands. :issue:`2741`
|
||||
- Add :meth:`sessions.SessionInterface.get_cookie_name` to allow
|
||||
setting the session cookie name dynamically. :pr:`3369`
|
||||
- Add :meth:`Config.from_file` to load config using arbitrary file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue