diff --git a/pytest_abra/dir_manager.py b/pytest_abra/dir_manager.py index 0125522..846d9f6 100644 --- a/pytest_abra/dir_manager.py +++ b/pytest_abra/dir_manager.py @@ -76,3 +76,10 @@ class DirManager: env_file = next(self.ENV_FILES.glob(f"*{search_string}*")) config: dict[str, str] = dotenv_values(env_file) # type: ignore return config + + @staticmethod + def get_latest_session_id(output_dir: Path) -> str: + """returns the name of the newest dir inside of output_dir""" + all_dirs = [d for d in output_dir.iterdir() if d.is_dir()] + newest_dir: Path = max(all_dirs, key=lambda x: x.stat().st_ctime) + return newest_dir.name