MCPcopy
hub / github.com/pallets/flask / test_config_from_envvar_missing

Function test_config_from_envvar_missing

tests/test_config.py:161–171  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

159
160
161def test_config_from_envvar_missing(monkeypatch):
162 monkeypatch.setattr("os.environ", {"FOO_SETTINGS": "missing.cfg"})
163 app = flask.Flask(__name__)
164 with pytest.raises(IOError) as e:
165 app.config.from_envvar("FOO_SETTINGS")
166 msg = str(e.value)
167 assert msg.startswith(
168 "[Errno 2] Unable to load configuration file (No such file or directory):"
169 )
170 assert msg.endswith("missing.cfg'")
171 assert not app.config.from_envvar("FOO_SETTINGS", silent=True)
172
173
174def test_config_missing():

Callers

nothing calls this directly

Calls 1

from_envvarMethod · 0.80

Tested by

no test coverage detected