Skip to content

Commit

Permalink
updated base handling
Browse files Browse the repository at this point in the history
  • Loading branch information
smythi93 committed Jul 28, 2024
1 parent 8dc53ee commit 57d4448
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/sflkit/runners/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,19 @@ def _common_base(directory: Path, tests: List[str]) -> Path:
else:
return None

@staticmethod
def _common_path(files: List[str]) -> Optional[Path]:
paths = []
for f in files:
if "::" in f:
paths.append(f.split("::")[0])
else:
paths.append(f)
common_path = os.path.commonpath(paths)
if common_path:
return Path(common_path)
return None

def _normalize_paths(
self,
tests: List[str],
Expand Down Expand Up @@ -341,13 +354,9 @@ def get_tests(
str_files = [str(files)]
else:
str_files = [str(f) for f in files]
common_base = self._common_base(root_dir, str_files)
if common_base:
file_base = common_base
elif base:
common_base = self._common_base(base, str_files)
if common_base:
file_base = common_base
common_path = self._common_path(str_files)
if common_path:
file_base = root_dir / common_path
c += str_files
process = subprocess.run(
[
Expand Down

0 comments on commit 57d4448

Please sign in to comment.