forked from orbit-oss/flask
clean up pytest.raises tests
This commit is contained in:
parent
ef7d01f0a0
commit
ef6c2b9e4a
4 changed files with 25 additions and 22 deletions
|
|
@ -133,9 +133,11 @@ def test_config_from_class():
|
|||
def test_config_from_envvar(monkeypatch):
|
||||
monkeypatch.setattr("os.environ", {})
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
with pytest.raises(RuntimeError) as e:
|
||||
app.config.from_envvar("FOO_SETTINGS")
|
||||
assert "'FOO_SETTINGS' is not set" in str(e.value)
|
||||
|
||||
assert "'FOO_SETTINGS' is not set" in str(e.value)
|
||||
assert not app.config.from_envvar("FOO_SETTINGS", silent=True)
|
||||
|
||||
monkeypatch.setattr(
|
||||
|
|
@ -147,8 +149,8 @@ def test_config_from_envvar(monkeypatch):
|
|||
|
||||
def test_config_from_envvar_missing(monkeypatch):
|
||||
monkeypatch.setattr("os.environ", {"FOO_SETTINGS": "missing.cfg"})
|
||||
app = flask.Flask(__name__)
|
||||
with pytest.raises(IOError) as e:
|
||||
app = flask.Flask(__name__)
|
||||
app.config.from_envvar("FOO_SETTINGS")
|
||||
msg = str(e.value)
|
||||
assert msg.startswith(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue