from pathlib import Path
import json


def prep_realdir(path: Path):
    """Prepare a real directory for tests."""
    base = path / "dataset"

    base.mkdir()
    (base / "foo").mkdir()
    (base / "foo" / "bar").mkdir()
    (base / "qux").mkdir()

    (base / "_meta.json").touch()
    (base / "readme.txt").touch()
    (base / "binary.dat").touch()
    (base / "foo" / "data.bin").touch()

    meta = {"hello": "world"}
    with open(base / "foo" / "data.bin_meta.json", "w") as f:
        json.dump(meta, f)

    with open(base / "foo" / "notReally.json", "w") as f:
        f.write("this is not valid JSON")
    return base