Test Utility Module¶
Convenience functions for unit testing.
-
browsepy.tests.utils.
clear_flask_context
()[source]¶ Clear flask current_app and request globals.
When using
flask.Flask.test_client()
, even as context manager, the flask’s globalsflask.current_app
andflask.request
are left dirty, so testing code relying on them will probably fail.This function clean said globals, and should be called after testing with
flask.Flask.test_client()
.
-
browsepy.tests.utils.
clear_localstack
(stack)[source]¶ Clear given werkzeug LocalStack instance.
Parameters: ctx (werkzeug.local.LocalStack) – local stack instance