33 lines
629 B
Python
33 lines
629 B
Python
from __future__ import annotations
|
|
|
|
import shutil
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from mdcaldav.config import Config
|
|
from mdcaldav.parser import parse_file
|
|
|
|
FIXTURE_VAULT = Path(__file__).parent / "fixtures" / "vault"
|
|
|
|
|
|
@pytest.fixture
|
|
def cfg() -> Config:
|
|
return Config()
|
|
|
|
|
|
@pytest.fixture
|
|
def vault(tmp_path: Path) -> Path:
|
|
"""A writable copy of the real note fixtures."""
|
|
dest = tmp_path / "vault"
|
|
shutil.copytree(FIXTURE_VAULT, dest)
|
|
return dest
|
|
|
|
|
|
@pytest.fixture
|
|
def tasks_of(cfg: Config):
|
|
def _load(vault: Path, rel: str):
|
|
return parse_file(vault / rel, rel, cfg)
|
|
|
|
return _load
|