(monkeypatch)
| 159 | |
| 160 | |
| 161 | def 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 | |
| 174 | def test_config_missing(): |
nothing calls this directly
no test coverage detected