From b49afa21ade898061d279ea20ba964d7e583c419 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Tue, 20 Jul 2010 15:09:51 +0100 Subject: [PATCH] Removed temp subscription contextmanager in blinker tests to support upcoming api improvements better --- tests/flask_tests.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/flask_tests.py b/tests/flask_tests.py index 698094b9..5d5c3794 100644 --- a/tests/flask_tests.py +++ b/tests/flask_tests.py @@ -1052,12 +1052,15 @@ class TestSignals(unittest.TestCase): def record(sender, template, context): recorded.append((template, context)) - with flask.template_rendered.temporarily_connected_to(record, app): + flask.template_rendered.connect(record, app) + try: rv = app.test_client().get('/') assert len(recorded) == 1 template, context = recorded[0] assert template.name == 'simple_template.html' assert context['whiskey'] == 42 + finally: + flask.template_rendered.disconnect(record, app) def test_request_signals(self): app = flask.Flask(__name__) @@ -1110,10 +1113,13 @@ class TestSignals(unittest.TestCase): def record(sender, exception): recorded.append(exception) - with flask.got_request_exception.temporarily_connected_to(record): + flask.got_request_exception.connect(record, app) + try: assert app.test_client().get('/').status_code == 500 assert len(recorded) == 1 assert isinstance(recorded[0], ZeroDivisionError) + finally: + flask.got_request_exception.disconnect(record, app) def suite():