def test_key_error_on_invalid_env(settings):
    """Assert error raised if env is not found in YAML"""
    with pytest.raises(KeyError):
        load(settings, filename=YAML, env="FOOBAR", silent=False)
Assert error raised if env is not found in YAML
tests/test_yaml_loader.py