Skip to content

Commit

Permalink
handle new typer.Option behavior (#12398)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzstoatzz authored Mar 23, 2024
1 parent bf44bd2 commit 7e6a258
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/prefect/cli/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ async def deploy(
prefect_file=prefect_file, ci=ci
)
parsed_names = []
for name in names:
for name in names or []:
if "*" in name:
parsed_names.extend(_parse_name_from_pattern(deploy_configs, name))
else:
Expand Down
6 changes: 3 additions & 3 deletions src/prefect/cli/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ async def run(
),
),
tags: List[str] = typer.Option(
[],
None,
"--tag",
help=("Tag(s) to be applied to flow run."),
),
Expand Down Expand Up @@ -930,7 +930,7 @@ async def run(
exit_with_error(
"`--watch-interval` can only be used with `--watch`.",
)
cli_params = _load_json_key_values(params, "parameter")
cli_params = _load_json_key_values(params or [], "parameter")
conflicting_keys = set(cli_params.keys()).intersection(multi_params.keys())
if conflicting_keys:
app.console.print(
Expand All @@ -939,7 +939,7 @@ async def run(
)
parameters = {**multi_params, **cli_params}

job_vars = _load_json_key_values(job_variables, "job variable")
job_vars = _load_json_key_values(job_variables or [], "job variable")
if start_in and start_at:
exit_with_error(
"Only one of `--start-in` or `--start-at` can be set, not both."
Expand Down
8 changes: 4 additions & 4 deletions tests/cli/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def test_start_agent_respects_work_queue_names(monkeypatch):
)
mock_agent.assert_called_once_with(
work_queues=["a", "b"],
work_queue_prefix=[],
work_queue_prefix=None,
work_pool_name=None,
prefetch_seconds=ANY,
limit=None,
Expand Down Expand Up @@ -171,7 +171,7 @@ def test_start_agent_respects_limit(monkeypatch):
)
mock_agent.assert_called_once_with(
work_queues=["test"],
work_queue_prefix=[],
work_queue_prefix=None,
work_pool_name=None,
prefetch_seconds=ANY,
limit=10,
Expand All @@ -187,7 +187,7 @@ def test_start_agent_respects_work_pool_name(monkeypatch):
)
mock_agent.assert_called_once_with(
work_queues=["test"],
work_queue_prefix=[],
work_queue_prefix=None,
work_pool_name="test-pool",
prefetch_seconds=ANY,
limit=None,
Expand Down Expand Up @@ -221,7 +221,7 @@ def test_start_agent_with_just_work_pool(monkeypatch):
)
mock_agent.assert_called_once_with(
work_queues=[],
work_queue_prefix=[],
work_queue_prefix=None,
work_pool_name="test-pool",
prefetch_seconds=ANY,
limit=None,
Expand Down
6 changes: 3 additions & 3 deletions tests/cli/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def test_start_worker_with_prefetch_seconds(monkeypatch):
mock_worker.assert_called_once_with(
name=None,
work_pool_name="test",
work_queues=[],
work_queues=None,
prefetch_seconds=30,
limit=None,
heartbeat_interval_seconds=30,
Expand Down Expand Up @@ -261,7 +261,7 @@ def test_start_worker_with_prefetch_seconds_from_setting_by_default(monkeypatch)
mock_worker.assert_called_once_with(
name=None,
work_pool_name="test",
work_queues=[],
work_queues=None,
prefetch_seconds=100,
limit=None,
heartbeat_interval_seconds=30,
Expand Down Expand Up @@ -290,7 +290,7 @@ def test_start_worker_with_limit(monkeypatch):
mock_worker.assert_called_once_with(
name=None,
work_pool_name="test",
work_queues=[],
work_queues=None,
prefetch_seconds=10,
limit=5,
heartbeat_interval_seconds=30,
Expand Down

0 comments on commit 7e6a258

Please sign in to comment.