def _traverse_paths(self, path: Path) -> Set[Path]:
"""
Traverses through paths and adds libraries to rfhub.
Helper function for get_library_paths.
"""
valid_lib_paths = set()
if self._is_library_with_init(path):
valid_lib_paths.add(path)
else:
for item in path.iterdir():
if item.is_dir():
if self._is_library_with_init(item):
valid_lib_paths.add(item)
if self._robot_files_candidates(item):
valid_lib_paths.update(self._get_valid_robot_files(path))
else:
valid_lib_paths.update(self._traverse_paths(item))
elif (
item.is_file()
and self._is_robot_keyword_file(item)
and not self._should_ignore(item)
):
valid_lib_paths.add(item)
return valid_lib_paths
Why don't you allow path to point to a file directly? _pathiterdir() will throw an exception.
Why, when path points to a _library_withinit, don't you look for _robot_filescandidates as well? You do that only in sub-folders
I started working on a pull request to fix this but I wanted your inputs.
With this, I need to rework some acceptance tests
def _traverse_paths(self, path: Path) -> Set[Path]:
"""
Traverses through paths and adds libraries to rfhub.
Helper function for get_library_paths.
"""
valid_lib_paths = set()
if self._is_library_with_init(path):
valid_lib_paths.add(path)
if self._robot_files_candidates(path):
valid_lib_paths.update(self._get_valid_robot_files(path))
elif path.is_dir():
for item in path.iterdir():
valid_lib_paths.update(self._traverse_paths(item))
elif (
path.is_file()
and self._is_robot_keyword_file(path)
and not self._should_ignore(path)
):
valid_lib_paths.add(path)
return valid_lib_paths
Why don't you allow path to point to a file directly? _pathiterdir() will throw an exception. Why, when path points to a _library_withinit, don't you look for _robot_filescandidates as well? You do that only in sub-folders
I started working on a pull request to fix this but I wanted your inputs.
With this, I need to rework some acceptance tests