Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/quart/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
26 changes: 26 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Loading