From 0472954057b13f542b7d22a5984b5ed0bf2de91b Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Mon, 19 Jun 2017 18:21:42 +0300 Subject: [PATCH] Fix #1978: Deprecate on_loop_available (#1989) --- CHANGES.rst | 8 ++++++++ aiohttp/web.py | 2 ++ tests/test_web_application.py | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 07be5303388..74e33b75108 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -38,6 +38,14 @@ Changes - Fix BadStatusLine caused by extra `CRLF` after `POST` data #1792 +- + +- Deprecate undocumented app.on_loop_available signal #1978 + +- + +- + 2.1.0 (2017-05-26) ------------------ diff --git a/aiohttp/web.py b/aiohttp/web.py index 1dac37d7cb4..c4afe4620c8 100644 --- a/aiohttp/web.py +++ b/aiohttp/web.py @@ -199,6 +199,8 @@ def add_subapp(self, prefix, subapp): @property def on_loop_available(self): + warnings.warn("on_loop_available is deprecated and will be removed", + DeprecationWarning, stacklevel=2) return self._on_loop_available @property diff --git a/tests/test_web_application.py b/tests/test_web_application.py index 1633bfe1b50..daa19ef5df4 100644 --- a/tests/test_web_application.py +++ b/tests/test_web_application.py @@ -50,7 +50,8 @@ def test_on_loop_available(loop): app = web.Application() cb = mock.Mock() - app.on_loop_available.append(cb) + with pytest.warns(DeprecationWarning): + app.on_loop_available.append(cb) app._set_loop(loop) cb.assert_called_with(app)