From 18401df4d6359a34a337c676856e25c180a31f10 Mon Sep 17 00:00:00 2001 From: Adam Hopkins Date: Tue, 21 Dec 2021 09:53:29 +0200 Subject: [PATCH 1/2] Move test_mode to a class variable --- sanic_testing/testing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sanic_testing/testing.py b/sanic_testing/testing.py index 43b5eda..bef5b67 100644 --- a/sanic_testing/testing.py +++ b/sanic_testing/testing.py @@ -57,10 +57,10 @@ def __init__( self, app: Sanic, port: typing.Optional[int] = PORT, host: str = HOST ) -> None: """Use port=None to bind to a random port""" + Sanic.test_mode = True self.app = app self.port = port self.host = host - self.app.test_mode = True self._do_request = _blank app.listener("after_server_start")(self._run_request) From 2b80ece8681f0974edeea4aeade1015fd85b4774 Mon Sep 17 00:00:00 2001 From: Adam Hopkins Date: Tue, 21 Dec 2021 09:57:24 +0200 Subject: [PATCH 2/2] Bump version --- sanic_testing/__init__.py | 2 +- sanic_testing/testing.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sanic_testing/__init__.py b/sanic_testing/__init__.py index d06cad1..cb047dd 100644 --- a/sanic_testing/__init__.py +++ b/sanic_testing/__init__.py @@ -1,4 +1,4 @@ from sanic_testing.manager import TestManager -__version__ = "0.7.0" +__version__ = "0.8.0" __all__ = ("TestManager",) diff --git a/sanic_testing/testing.py b/sanic_testing/testing.py index bef5b67..ca2b888 100644 --- a/sanic_testing/testing.py +++ b/sanic_testing/testing.py @@ -62,7 +62,7 @@ def __init__( self.port = port self.host = host self._do_request = _blank - app.listener("after_server_start")(self._run_request) + app.after_server_start(self._run_request) def _run_request(self, *args, **kwargs): return self._do_request(*args, **kwargs)