Python 3.10 is now available in preview.

Module: google.appengine.runtime.context.ctx_test_util

Test func/class decorator that runs tests in a clean context.


@ctx_test_util.isolated_context() class MySuite(unittest.TestCase): ...


class MySuite(unittest.TestCase):

@ctx_test_util.isolated_context() def testFoo(self): ...


both_context_modes(...): Adds subtests which test the non-default context mode.

isolated_context(...): Decorates a test function or class to run itself in a clean context.

set_both(...): Write to both legacy context (os.environ) and new contextvars.