diff --git a/flask/signals.py b/flask/signals.py index 4a2cfe07..c9b8a210 100644 --- a/flask/signals.py +++ b/flask/signals.py @@ -53,4 +53,4 @@ got_request_exception = _signals.signal('got-request-exception') appcontext_tearing_down = _signals.signal('appcontext-tearing-down') appcontext_pushed = _signals.signal('appcontext-pushed') appcontext_popped = _signals.signal('appcontext-popped') -message_flashed = _signals.signal('message-flashed') \ No newline at end of file +message_flashed = _signals.signal('message-flashed') diff --git a/tests/test_signals.py b/tests/test_signals.py index b687b6e8..bab5b155 100644 --- a/tests/test_signals.py +++ b/tests/test_signals.py @@ -59,16 +59,14 @@ def test_before_render_template(): context['whiskey'] = 43 recorded.append((template, context)) - flask.before_render_template.connect(record, app) - try: + with flask.before_render_template.connected_to(record): rv = app.test_client().get('/') assert len(recorded) == 1 template, context = recorded[0] assert template.name == 'simple_template.html' assert context['whiskey'] == 43 assert rv.data == b'

43

' - finally: - flask.before_render_template.disconnect(record, app) + def test_request_signals(): app = flask.Flask(__name__)