Skip to content

Commit

Permalink
Fix vscode popup (oops) (#18)
Browse files Browse the repository at this point in the history
* Fix vscode popup (oops)

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>

* Fix broken test

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>

---------

Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
  • Loading branch information
lebrice authored Jan 31, 2025
1 parent 1ef946a commit 27c5fa2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repos:

# python docstring formatting
- repo: https://github.com/myint/docformatter
rev: v1.7.5
rev: eb1df347edd128b30cd3368dddc3aa65edcfac38 # Don't autoupdate until https://github.com/PyCQA/docformatter/issues/293 is fixed
hooks:
- id: docformatter
language: python
Expand Down
3 changes: 2 additions & 1 deletion hydra_auto_schema/auto_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,9 @@ def _try_to_install_yaml_vscode_extension() -> bool:
"Running `code --install-extension redhat.vscode-yaml` to install the yaml extension for vscode."
)
exitcode, output = subprocess.getstatusoutput(
("code", "--install-extension", "redhat.vscode-yaml")
"code --install-extension redhat.vscode-yaml"
)

logger.debug(output)
return exitcode == 0

Expand Down
12 changes: 6 additions & 6 deletions tests/auto_schema_test.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import json
import os
from pathlib import Path
import shutil
import subprocess
from pathlib import Path

import pytest
import yaml
from hydra.core.config_store import ConfigStore
from pytest_regressions.file_regression import FileRegressionFixture
import subprocess

from hydra_auto_schema.auto_schema import (
_add_schema_header,
_try_to_install_yaml_vscode_extension,
_create_schema_for_config,
_try_to_install_yaml_vscode_extension,
add_schemas_to_all_hydra_configs,
)

Expand Down Expand Up @@ -93,9 +93,9 @@ def test_doesnt_raise_when_vscode_isnt_installed(

check_output = subprocess.check_output

def _mock_check_output(args: tuple[str, ...], *other_args, **kwargs):
assert args[0] == "code"
new_command = ("code_blabla_doesnt_exist",) + args[1:]
def _mock_check_output(args: str, *other_args, **kwargs):
assert args.split()[0] == "code"
new_command = args.replace("code", "code_blabla_doesnt_exist")
return check_output(new_command, *other_args, **kwargs)

monkeypatch.setattr(
Expand Down

0 comments on commit 27c5fa2

Please sign in to comment.