Skip to content

Commit

Permalink
updated pytest to use provided files
Browse files Browse the repository at this point in the history
  • Loading branch information
smythi93 committed Jul 28, 2024
1 parent d1c57ec commit 5cfb832
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/sflkit/runners/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def get_absolute_files(
@staticmethod
def normalize_paths(
tests: List[str],
files: Set[str] = None,
files: Set[Path] = None,
directory: Optional[Path] = None,
root_dir: Optional[Path] = None,
):
Expand Down Expand Up @@ -385,13 +385,7 @@ def get_tests(
str_files = [str(files)]
else:
str_files = [str(f) for f in files]
common_path = self.common_path(str_files)
if common_path:
common_base = self.common_base(root_dir, [str(common_path)])
if common_base:
file_base = common_base / common_path
else:
file_base = root_dir / common_path
files_bases = self.get_absolute_files(self.get_files(str_files), directory)
c += str_files
process = subprocess.run(
[
Expand All @@ -408,7 +402,7 @@ def get_tests(
)
LOGGER.info(f"pytest collection finished with {process.returncode}")
tests = PytestStructure.parse_tests(process.stdout.decode("utf8"))
return self.normalize_paths(tests, file_base, directory, root_dir)
return self.normalize_paths(tests, file_bases, directory, root_dir)

@staticmethod
def __get_pytest_result__(
Expand Down

0 comments on commit 5cfb832

Please sign in to comment.