I have set up local unit tests for a Python app according to the
documentation on the App Engine site [1]. The app has appstats
configured as a WSGI middleware through appengine_config.py by using
the webapp_add_wsgi_middleware() directive:
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_middleware(app)
return app
When running the tests I want to disable appstats. appstats needs
REQUEST_ID_HASH environment variable which isn't set during tests, but
recording data doesn't make much sense at all during tests.
The current idea is to monkey-patch
appengine_config.webapp_add_wsgi_middleware when it's first imported
by the test runner - before any test is actually executed:
import appengine_config
appengine_config.webapp_add_wsgi_middleware = lambda app: app
But I wonder if there are better (or more documented) alternatives to
modify settings from appengine_config.py during tests.
--Andi
[1] http://code.google.com/appengine/docs/python/tools/localunittesting.html
--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.