Skip to content
Myr

Add test to catch imports at Flask instantiation.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Ron DuPlain · committed by Ron DuPlain · parent c824ffc · Browse files · 2 files+13 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+13 added−0 removed

  • other:+13 added−0 removed

2 files+13 added−0 removed

added:flask/testsuite/test_apps/importerror.py+2 added
1# NoImportsTestCase2raise NotImplementedError
modified:flask/testsuite/helpers.py+11 added
329 unmodified lines
330 self.assert_equal(flask.url_for('myview', _method='POST'),331 '/myview/create')332333334class NoImportsTestCase(FlaskTestCase):335 "Test Flasks are created without __import__."336337 def test_name_with_import_error(self):338 try:339 flask.Flask('importerror')340 except NotImplementedError:341 self.fail('Flask(import_name) is importing import_name.')342343344def suite():345 suite = unittest.TestSuite()346 if flask.json_available:347 suite.addTest(unittest.makeSuite(JSONTestCase))348 suite.addTest(unittest.makeSuite(SendfileTestCase))349 suite.addTest(unittest.makeSuite(LoggingTestCase))350 suite.addTest(unittest.makeSuite(NoImportsTestCase))351 return suite