diff --git a/sanic/app.py b/sanic/app.py index 87667825..06540088 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -649,7 +649,7 @@ class Sanic: def run(self, host=None, port=None, debug=False, ssl=None, sock=None, workers=1, protocol=None, backlog=100, stop_event=None, register_sys_signals=True, - access_log=True, auto_reload=False): + access_log=True, **kwargs): """Run the HTTP Server and listen until keyboard interrupt or term signal. On termination, drain connections before closing. @@ -667,6 +667,13 @@ class Sanic: :param protocol: Subclass of asyncio protocol class :return: Nothing """ + # Default auto_reload to false + auto_reload = False + # If debug is set, default it to true + if debug: + auto_reload = True + # Allow for overriding either of the defaults + auto_reload = kwargs.get("auto_reload", auto_reload) if sock is None: host, port = host or "127.0.0.1", port or 8000 diff --git a/sanic/testing.py b/sanic/testing.py index a639e16e..3a1d15c5 100644 --- a/sanic/testing.py +++ b/sanic/testing.py @@ -45,7 +45,7 @@ class SanicTestClient: def _sanic_endpoint_test( self, method='get', uri='/', gather_request=True, - debug=False, server_kwargs={}, + debug=False, server_kwargs={"auto_reload": False}, *request_args, **request_kwargs): results = [None, None] exceptions = []