[DEV] Cross platform test fixture helpers (#1058)
This commit is contained in:
parent
6510fd0999
commit
3fbdd26257
2 changed files with 4 additions and 5 deletions
|
|
@ -15,14 +15,12 @@ _EXPECTED_DOWNLOADS_SUMMARY_PATH = RESOURCE_PATH / "expected_downloads_summaries
|
|||
|
||||
|
||||
def _get_files_in_directory(relative_directory: Path | str) -> List[Path]:
|
||||
relative_path_part_idx = 3 # Cuts /tmp/<tmp_folder>
|
||||
if IS_WINDOWS:
|
||||
relative_path_part_idx = 7 # Cuts C:\Users\<user>\AppData\Local\Temp\<tmp_folder>
|
||||
|
||||
relative_file_paths: List[Path] = []
|
||||
for path in Path(relative_directory).rglob("*"):
|
||||
if path.is_file():
|
||||
relative_path = Path(*path.parts[relative_path_part_idx:])
|
||||
relative_path = Path(
|
||||
str(path).removeprefix(str(relative_directory)).removeprefix(os.path.sep)
|
||||
)
|
||||
relative_file_paths.append(relative_path)
|
||||
|
||||
return relative_file_paths
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ class TestLogger:
|
|||
except ValueError as exc:
|
||||
Logger.log_exception(exception=exc)
|
||||
|
||||
time.sleep(0.1) # flush time
|
||||
Logger.cleanup(has_error=has_error)
|
||||
assert not os.path.isfile(Logger.debug_log_filename())
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue