diff --git a/flask/testsuite/helpers.py b/flask/testsuite/helpers.py index 41e31be9..ee365605 100644 --- a/flask/testsuite/helpers.py +++ b/flask/testsuite/helpers.py @@ -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 diff --git a/flask/testsuite/test_apps/importerror.py b/flask/testsuite/test_apps/importerror.py new file mode 100644 index 00000000..eb298b9b --- /dev/null +++ b/flask/testsuite/test_apps/importerror.py @@ -0,0 +1,2 @@ +# NoImportsTestCase +raise NotImplementedError