forked from orbit-oss/flask
Add test to catch imports at Flask instantiation.
This commit is contained in:
parent
c824ffcf38
commit
26a9c2079d
2 changed files with 13 additions and 0 deletions
|
|
@ -331,10 +331,21 @@ class LoggingTestCase(FlaskTestCase):
|
|||
'/myview/create')
|
||||
|
||||
|
||||
class NoImportsTestCase(FlaskTestCase):
|
||||
"Test Flasks are created without __import__."
|
||||
|
||||
def test_name_with_import_error(self):
|
||||
try:
|
||||
flask.Flask('importerror')
|
||||
except NotImplementedError:
|
||||
self.fail('Flask(import_name) is importing import_name.')
|
||||
|
||||
|
||||
def suite():
|
||||
suite = unittest.TestSuite()
|
||||
if flask.json_available:
|
||||
suite.addTest(unittest.makeSuite(JSONTestCase))
|
||||
suite.addTest(unittest.makeSuite(SendfileTestCase))
|
||||
suite.addTest(unittest.makeSuite(LoggingTestCase))
|
||||
suite.addTest(unittest.makeSuite(NoImportsTestCase))
|
||||
return suite
|
||||
|
|
|
|||
2
flask/testsuite/test_apps/importerror.py
Normal file
2
flask/testsuite/test_apps/importerror.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# NoImportsTestCase
|
||||
raise NotImplementedError
|
||||
Loading…
Add table
Add a link
Reference in a new issue