yama/testsuite/helpers/yama_helpers.py

24 lines
610 B
Python

import shutil
import subprocess
from pathlib import Path
from typing import Set
def set_up_simple_yama(path: Path):
path.mkdir(exist_ok=True)
subprocess.check_call(("yama", "init"), cwd=path)
example_zstd_path = Path(__file__).parent.parent.parent.joinpath(
"example_zstd.dict"
)
shutil.copyfile(example_zstd_path, path.joinpath("important_zstd.dict"))
def list_bloblog_ids(pile: Path) -> Set[int]:
result = set()
for p in pile.joinpath("bloblog").iterdir():
try:
result.add(int(p.name))
except ValueError:
pass
return result