Skip to content

Commit 60c1959

Browse files
authored
[dg] Exit properly upon not finding editor in PATH (#28433)
## Summary When the specified editor isn't found on the PATH, raises an exception rather than printing (and later failing on invocation of the command). ## Test Plan Tested locally, verified early exit.
1 parent da6854a commit 60c1959

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

python_modules/libraries/dagster-dg/dagster_dg/utils/editor/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ def run_editor_cli_command(executable_name: str, args: list[str]) -> bytes:
2929

3030
def recommend_yaml_extension(executable_name: str) -> None:
3131
if not has_editor_cli_command(executable_name):
32-
click.echo(
32+
raise click.ClickException(
3333
f"Could not find `{executable_name}` executable in PATH. In order to use the dagster-components-schema extension, "
3434
"please install the redhat.vscode-yaml extension manually."
3535
)
36-
return
3736

3837
extensions = (
3938
run_editor_cli_command(executable_name, ["--list-extensions"]).decode("utf-8").split("\n")

python_modules/libraries/dagster-dg/dagster_dg_tests/cli_tests/test_configure_editor_commands.py

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def test_utils_configure_editor(editor: str) -> None:
1919
with (
2020
ProxyRunner.test() as runner,
2121
TemporaryDirectory() as extension_dir,
22+
mock.patch("dagster_dg.utils.editor.has_editor_cli_command", new=lambda x: True),
2223
mock.patch("dagster_dg.utils.editor.run_editor_cli_command", new=mock_vscode_cli_command),
2324
mock.patch(
2425
"dagster_dg.utils.editor.get_default_extension_dir",

0 commit comments

Comments
 (0)