Initial commit
This commit is contained in:
32
tests/conftest.py
Normal file
32
tests/conftest.py
Normal file
@@ -0,0 +1,32 @@
|
||||
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
|
||||
Reference in New Issue
Block a user