34 lines
901 B
Python
34 lines
901 B
Python
from __future__ import annotations
|
|
from dataclasses import dataclass
|
|
from pathlib import Path
|
|
|
|
|
|
@dataclass
|
|
class TestDataBundle:
|
|
base_path: Path
|
|
format: str = "json"
|
|
|
|
def cobol_input(self) -> Path:
|
|
return self.base_path / "cobol" / "input.bin"
|
|
|
|
def spark_input_dir(self) -> Path:
|
|
return self.base_path / "spark" / "input"
|
|
|
|
def native_input(self) -> Path:
|
|
return self.base_path / "native" / "input.json"
|
|
|
|
def ensure_dirs(self):
|
|
for d in [self.base_path / "cobol",
|
|
self.base_path / "spark" / "input",
|
|
self.base_path / "native"]:
|
|
d.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
from tempfile import TemporaryDirectory
|
|
_tmp = TemporaryDirectory()
|
|
_b = TestDataBundle(base_path=Path(_tmp.name))
|
|
assert _b.cobol_input().name == "input.bin"
|
|
_b.ensure_dirs()
|
|
assert _b.cobol_input().parent.exists()
|
|
_tmp.cleanup()
|