def test_test_context_broken_app(self): from webtest import TestApp from tg import AppConfig, config from tg.request_local import context app = TestApp(AppConfig( minimal=True, root_controller=None ).make_wsgi_app()) try: with test_context(app): raise RuntimeError('This is an error') except RuntimeError: pass else: assert False, 'Should have raised RuntimeError...' with test_context(app): config._pop_object() # Check that context got cleaned up even though config caused an exception assert not context._object_stack() with test_context(app): context._pop_object() # Check that config got cleaned up even though context caused an exception assert not config._object_stack()
def test_test_context_broken_app(self): from webtest import TestApp from tg import AppConfig, config from tg.request_local import context app = TestApp( AppConfig(minimal=True, root_controller=None).make_wsgi_app()) try: with test_context(app): raise RuntimeError('This is an error') except RuntimeError: pass else: assert False, 'Should have raised RuntimeError...' with test_context(app): config._pop_object() # Check that context got cleaned up even though config caused an exception assert not context._object_stack() with test_context(app): context._pop_object() # Check that config got cleaned up even though context caused an exception assert not config._object_stack()