From 670b68ed98acd5000bdf814a49cebd9cffedb7da Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Tue, 5 Aug 2025 23:32:09 +0500 Subject: [PATCH 1/2] cli: activate --debug/--no-debug flag for `quart run` --- src/quart/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/quart/cli.py b/src/quart/cli.py index 7d66fc3..68002f6 100644 --- a/src/quart/cli.py +++ b/src/quart/cli.py @@ -663,6 +663,9 @@ def run_command( ) +run_command.params.insert(0, _debug_option) + + @click.command("shell", short_help="Run a shell in the app context.") @with_appcontext def shell_command() -> None: From 0ed22a0ddd090ffaf6f534aec84a923cdbb28cdb Mon Sep 17 00:00:00 2001 From: PrinceWebCoder Date: Tue, 5 Aug 2025 23:32:59 +0500 Subject: [PATCH 2/2] tests(cli): add coverage for --debug/--no-debug behaviour --- tests/test_cli.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index aca9c44..04dbf38 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -132,3 +132,29 @@ def test_load_dotenv_beats_dotquartenv(empty_cwd: Path) -> None: load_dotenv() assert os.environ.pop("TEST_ENV_VAR", None) == env_value + + +def test_run_command_debug_option(app: Mock) -> None: + runner = CliRunner() + runner.invoke(cli, ["--app", "module:app", "run", "--debug"]) + app.run.assert_called_once_with( + debug=True, + host="127.0.0.1", + port=5000, + certfile=None, + keyfile=None, + use_reloader=True, + ) + + +def test_run_command_no_debug_option(dev_app: Mock) -> None: + runner = CliRunner() + runner.invoke(cli, ["--app", "module:app", "run", "--no-debug"]) + dev_app.run.assert_called_once_with( + debug=False, + host="127.0.0.1", + port=5000, + certfile=None, + keyfile=None, + use_reloader=False, + )