Skip to content
Myr

Merge branch '0.12-maintenance'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Markus Unterwaditzer · committed by Markus Unterwaditzer · parents 582a878, b0820bc · Browse files · 4 files+20 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+20 added−4 removed

  • tests:+8 added−0 removed
  • other:+12 added−4 removed

4 files+20 added−4 removed

modified:flask/cli.py+10 added-4 removed
87 unmodified lines
8889 try:90 __import__(module)91 except ImportError:92 raise NoAppException('The file/path provided (%s) does not appear to '93 'exist. Please verify the path is correct. If '94 'app is not on PYTHONPATH, ensure the extension '95 'is .py' % module)92 # Reraise the ImportError if it occurred within the imported module.93 # Determine this by checking whether the trace has a depth > 1.94 if sys.exc_info()[-1].tb_next:95 raise96 else:97 raise NoAppException('The file/path provided (%s) does not appear'98 ' to exist. Please verify the path is '99 'correct. If app is not on PYTHONPATH, '100 'ensure the extension is .py' % module)101102 mod = sys.modules[module]103 if app_obj is None:104 app = find_best_app(mod)105 else:
412 unmodified lines
added:tests/test_apps/cliapp/importerrorapp.py+7 added
1from __future__ import absolute_import, print_function23from flask import Flask45raise ImportError()67testapp = Flask('testapp')
modified:tests/test_cli.py+1 added
81 unmodified lines
82 assert locate_app("cliapp.multiapp:app1").name == "app1"83 pytest.raises(NoAppException, locate_app, "notanpp.py")84 pytest.raises(NoAppException, locate_app, "cliapp/app")85 pytest.raises(RuntimeError, locate_app, "cliapp.app:notanapp")86 pytest.raises(ImportError, locate_app, "cliapp.importerrorapp")878889def test_find_default_import_path(test_apps, monkeypatch, tmpdir):90 """Test of find_default_import_path."""
103 unmodified lines
modified:CHANGES+2 added
11 unmodified lines
12--------------1314Bugfix release, unreleased1516- Prevent `flask run` from showing a NoAppException when an ImportError occurs17 within the imported application module.18- Fix encoding behavior of ``app.config.from_pyfile`` for Python 3. Fix19 ``#2118``.2021Version 0.12
595 unmodified lines