""" Using gaeunit.py to run tests -- while tests can't be run from the commandline, this is currently the best way I've found to use the Python unittest module. """ import unittest from utils import adjust_sys_path adjust_sys_path() # And just write your unittests like normal below. import flask class LibsImportTest(unittest.TestCase): def setUp(self): import libs.flask self.path = libs.flask.__path__ def test_regular_path_without_libs(self): flask_path = flask.__path__ assert flask_path == self.path class AppTest(unittest.TestCase): def setUp(self): from app import create_app
""" Using gaeunit.py to run tests -- while tests can't be run from the commandline, this is currently the best way I've found to use the Python unittest module. """ import unittest from utils import adjust_sys_path adjust_sys_path() # And just write your unittests like normal below. import flask class LibsImportTest(unittest.TestCase): def setUp(self): import libs.flask self.path = libs.flask.__path__ def test_regular_path_without_libs(self): flask_path = flask.__path__ assert flask_path == self.path class AppTest(unittest.TestCase): def setUp(self): from app import create_app app = create_app() self.app = app.test_client()
#!/usr/bin/env python """Google App Engine uses this file to run your Flask application.""" import os import settings from utils import adjust_sys_path adjust_sys_path() if settings.debug: adjust_sys_path('ziplibs') # Enable ctypes for Jinja debugging from google.appengine.tools.dev_appserver import HardenedModulesHook HardenedModulesHook._WHITE_LIST_C_MODULES += ['_ctypes', 'gestalt'] else: adjust_sys_path(os.path.join('ziplibs.zip', 'ziplibs')) from app import create_app from werkzeug_debugger_appengine import get_debugged_app from flaskext.csrf import csrf from gae_mini_profiler import profiler, config as profiler_config profiler_config.enabled_profiler_emails = settings.admin_emails app = create_app() csrf(app) # If we're on the local server, let's enable Flask debugging. # For more information: http://goo.gl/RNofH if settings.debug: app.debug = True app = get_debugged_app(app) app = profiler.ProfilerWSGIMiddleware(app)
#!/usr/bin/env python """Google App Engine uses this file to run your Flask application.""" import os from wsgiref.handlers import CGIHandler import settings from utils import adjust_sys_path adjust_sys_path() if settings.debug: adjust_sys_path('ziplibs') # Enable ctypes for Jinja debugging from google.appengine.tools.dev_appserver import HardenedModulesHook HardenedModulesHook._WHITE_LIST_C_MODULES += ['_ctypes', 'gestalt'] else: adjust_sys_path(os.path.join('ziplibs.zip', 'ziplibs')) from app import create_app from werkzeug_debugger_appengine import get_debugged_app from flaskext.csrf import csrf from gae_mini_profiler import profiler, config as profiler_config def main(): app = create_app() csrf(app) # If we're on the local server, let's enable Flask debugging. # For more information: http://goo.gl/RNofH if settings.debug: app.debug = True app = get_debugged_app(app)