Skip to content

Commit b8ad0ee

Browse files
author
aoright
committed
tests: add test for config.from_file missing file with silent option
Signed-off-by: aoright <102943475+aoright@users.noreply.github.com>
1 parent d318b68 commit b8ad0ee

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/test_config.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ def test_config_from_file_toml():
4545
common_object_test(app)
4646

4747

48+
def test_config_from_file_missing_silent():
49+
app = flask.Flask(__name__)
50+
assert not app.config.from_file("nonexistent.json", json.load, silent=True)
51+
with pytest.raises(OSError):
52+
app.config.from_file("nonexistent.json", json.load, silent=False)
53+
54+
4855
def test_from_prefixed_env(monkeypatch):
4956
monkeypatch.setenv("FLASK_STRING", "value")
5057
monkeypatch.setenv("FLASK_BOOL", "true")

0 commit comments

Comments
 (0)