Skip to content
Myr

Fixed an error reporting bug with flask.Config.from_envvar

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

authored by Armin Ronacher · committed by Armin Ronacher · parent 6913dc1 · Browse files · 3 files+29 added−1 removed
This commit

State

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

Diff stats

3 files+29 added−1 removed

  • tests:+20 added−0 removed
  • other:+9 added−1 removed

3 files+29 added−1 removed

modified:tests/flask_tests.py+20 added
715 unmodified lines
716 app = flask.Flask(__name__)717 app.config.from_object(Test)718 self.common_object_test(app)719720 def test_config_from_envvar(self):721 import os722 env = os.environ723 try:724 os.environ = {}725 app = flask.Flask(__name__)726 try:727 app.config.from_envvar('FOO_SETTINGS')728 except RuntimeError, e:729 assert "'FOO_SETTINGS' is not set" in str(e)730 else:731 assert 0, 'expected exception'732 not app.config.from_envvar('FOO_SETTINGS', silent=True)733734 os.environ = {'FOO_SETTINGS': 'flask_tests.py'}735 assert app.config.from_envvar('FOO_SETTINGS')736 self.common_object_test(app)737 finally:738 os.environ = env739740741def suite():742 from minitwit_tests import MiniTwitTestCase743 from flaskr_tests import FlaskrTestCase744 suite = unittest.TestSuite()
16 unmodified lines
modified:CHANGES+7 added
6 unmodified lines
7-----------89Release date to be announced, codename to be selected.1011Version 0.3.112-------------1314Bugfix release, released May 28th1516- fixed a error reporting bug with :meth:`flask.Config.from_envvar`1718Version 0.319-----------2021Released on May 28th, codename Schnaps
36 unmodified lines
modified:flask.py+2 added-1 removed
696 unmodified lines
697 return False698 raise RuntimeError('The environment variable %r is not set '699 'and as such configuration could not be '700 'loaded. Set this variable and make it '701 'point to a configuration file')701 'point to a configuration file' %702 variable_name)703 self.from_pyfile(rv)704 return True705706 def from_pyfile(self, filename):
725 unmodified lines