diff --git a/bundled/tool/lsp_server.py b/bundled/tool/lsp_server.py index 6ff39fc..b1906df 100644 --- a/bundled/tool/lsp_server.py +++ b/bundled/tool/lsp_server.py @@ -11,7 +11,11 @@ import sys import traceback from typing import Any -from tach.check import CheckResult + +try: + from tach.check import CheckResult +except ImportError: + pass # ********************************************************** diff --git a/bundled/tool/tach_util.py b/bundled/tool/tach_util.py index 991c096..60916f0 100644 --- a/bundled/tool/tach_util.py +++ b/bundled/tool/tach_util.py @@ -18,7 +18,7 @@ def run_tach_check(argv: list[str], path: str): project_config = parse_project_config(root=root) if project_config is None: raise TachSetupError( - f"{BCOLORS.FAIL} {CONFIG_FILE_NAME}.(yml|yaml) not found in {root}{BCOLORS.ENDC}", + f"{BCOLORS.FAIL} {CONFIG_FILE_NAME}.(toml) not found in {root}{BCOLORS.ENDC}", ) if exclude_paths is not None and project_config.exclude is not None: @@ -27,7 +27,7 @@ def run_tach_check(argv: list[str], path: str): exclude_paths = project_config.exclude checked_result: CheckResult = check( - project_root=root, project_config=project_config, exclude_paths=exclude_paths + project_root=root, project_config=project_config ) for boundary_error in checked_result.errors: # Hack for now - update error message displayed to user diff --git a/src/test/python_tests/lsp_test_client/utils.py b/src/test/python_tests/lsp_test_client/utils.py index 736561f..20257a0 100644 --- a/src/test/python_tests/lsp_test_client/utils.py +++ b/src/test/python_tests/lsp_test_client/utils.py @@ -12,7 +12,7 @@ import platform from random import choice -from .constants import PROJECT_ROOT, TEST_DATA +from .constants import PROJECT_ROOT def normalizecase(path: str) -> str: @@ -72,6 +72,5 @@ def get_initialization_options(): setting["workspace"] = as_uri(str(PROJECT_ROOT)) setting["interpreter"] = [] - setting["args"] = ["--root", str(TEST_DATA)] print(setting) return {"settings": [setting]} diff --git a/src/test/python_tests/test_data/tach.toml b/src/test/python_tests/test_data/tach.toml new file mode 100644 index 0000000..73ee760 --- /dev/null +++ b/src/test/python_tests/test_data/tach.toml @@ -0,0 +1,12 @@ +modules = [ + { path = "sample1", depends_on = [], strict = true }, + { path = "sample2", depends_on = [] }, +] +exclude = [ + "docs", + "tests", +] +source_roots = [ + ".", +] +ignore_type_checking_imports = false diff --git a/src/test/python_tests/test_data/tach.yml b/src/test/python_tests/test_data/tach.yml deleted file mode 100644 index 5cd4d10..0000000 --- a/src/test/python_tests/test_data/tach.yml +++ /dev/null @@ -1,13 +0,0 @@ -modules: -- path: sample1 - depends_on: [] - strict: true -- path: sample2 - depends_on: [] - strict: false -exclude: -- docs -- tests -exact: false -disable_logging: false -ignore_type_checking_imports: false diff --git a/src/test/python_tests/test_server.py b/src/test/python_tests/test_server.py index 7b8a888..0069173 100644 --- a/src/test/python_tests/test_server.py +++ b/src/test/python_tests/test_server.py @@ -65,7 +65,7 @@ def test_import_example(test_file_path, expected): contents = test_file_path.read_text() actual = [] - with session.LspSession() as ls_session: + with session.LspSession(cwd=constants.TEST_DATA) as ls_session: ls_session.initialize(defaults.VSCODE_DEFAULT_INITIALIZE) done = Event()