Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sparshg committed Aug 24, 2024
1 parent 5f23bec commit ffc4964
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
6 changes: 5 additions & 1 deletion bundled/tool/lsp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


# **********************************************************
Expand Down
4 changes: 2 additions & 2 deletions bundled/tool/tach_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/test/python_tests/lsp_test_client/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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]}
12 changes: 12 additions & 0 deletions src/test/python_tests/test_data/tach.toml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 0 additions & 13 deletions src/test/python_tests/test_data/tach.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/python_tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ffc4964

Please sign in to comment.