Skip to content

Commit aaa2884

Browse files
committed
Skip test data in project analyzer looking for .py files
1 parent 8025ffa commit aaa2884

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/finecode/workspace_manager/project_analyzer.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ def get_files_by_projects(projects_dirs_paths: list[Path]) -> dict[Path, list[Pa
88
project_dir = projects_dirs_paths[0]
99
files_by_projects_dirs[project_dir] = [
1010
path for path in project_dir.rglob("*.py")
11+
# TODO: make configurable?
12+
if '__testdata__' not in path.relative_to(project_dir).parts and '.venvs' not in path.relative_to(project_dir).parts
1113
]
1214
else:
1315
# copy to avoid modifying of argument values
@@ -54,6 +56,8 @@ def get_files_by_projects(projects_dirs_paths: list[Path]) -> dict[Path, list[Pa
5456
# if there are no children with subprojects, we can just rglob
5557
files_by_projects_dirs[project_dir_path].extend(
5658
path for path in project_dir_path.rglob("*.py")
59+
# TODO: make configurable?
60+
if '__testdata__' not in path.relative_to(project_dir_path).parts and '.venvs' not in path.relative_to(project_dir_path).parts
5761
)
5862
else:
5963
# process all dir items which don't have child projects
@@ -66,6 +70,8 @@ def get_files_by_projects(projects_dirs_paths: list[Path]) -> dict[Path, list[Pa
6670
elif dir_item.is_dir():
6771
files_by_projects_dirs[project_dir_path].extend(
6872
path for path in dir_item.rglob("*.py")
73+
# TODO: make configurable?
74+
if '__testdata__' not in path.relative_to(project_dir_path).parts and '.venvs' not in path.relative_to(project_dir_path).parts
6975
)
7076

7177
# process all dir items which have child projects
@@ -103,6 +109,8 @@ def get_files_by_projects(projects_dirs_paths: list[Path]) -> dict[Path, list[Pa
103109
# subdirectory without child projects, rglob it
104110
files_by_projects_dirs[project_dir_path].extend(
105111
path for path in dir_item.rglob("*.py")
112+
# TODO: make configurable?
113+
if '__testdata__' not in path.relative_to(project_dir_path).parts and '.venvs' not in path.relative_to(project_dir_path).parts
106114
)
107115

108116
return files_by_projects_dirs

src/finecode/workspace_manager/runner/runner_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ async def reload_action(runner: ExtensionRunnerInfo, action_name: str) -> None:
203203
)
204204

205205

206-
async def resolve_package_path(runner: ExtensionRunnerInfo, package_name: str) -> None:
206+
async def resolve_package_path(runner: ExtensionRunnerInfo, package_name: str) -> dict[str, str]:
207207
# resolving package path is used directly after initialization of runner to get full
208208
# config, which is then registered in runner. In this time runner is not available
209209
# for any other actions, so `runner.started_event` stays not set and should not be

0 commit comments

Comments
 (0)