forked from orbit-oss/flask
Improved error message for configuration files
This commit is contained in:
parent
ed1b34c724
commit
778e44e39e
2 changed files with 17 additions and 1 deletions
|
|
@ -1018,6 +1018,18 @@ class ConfigTestCase(unittest.TestCase):
|
|||
finally:
|
||||
os.environ = env
|
||||
|
||||
def test_config_missing(self):
|
||||
app = flask.Flask(__name__)
|
||||
try:
|
||||
app.config.from_pyfile('missing.cfg')
|
||||
except IOError, e:
|
||||
msg = str(e)
|
||||
assert msg.startswith('[Errno 2] Unable to load configuration '
|
||||
'file (No such file or directory):')
|
||||
assert msg.endswith("missing.cfg'")
|
||||
else:
|
||||
assert 0, 'expected config'
|
||||
|
||||
|
||||
class SubdomainTestCase(unittest.TestCase):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue