From cb5e38b50384c2913c0e34092469fff811bed915 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 28 Nov 2025 22:15:44 +0100 Subject: [PATCH] test: Add rc config file test --- test/test_configuration.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/test_configuration.py b/test/test_configuration.py index 07ded09..ecbaeaf 100644 --- a/test/test_configuration.py +++ b/test/test_configuration.py @@ -60,3 +60,29 @@ class TestEnv: env = parse_env() assert env["task_rc"] == Path("/a/dir/that/dont/exist/file") assert env["task_data"] == Path("~/somewhere/tasks") + + +@pytest.fixture +def fake_rc(tmp_path: Path, monkeypatch): + rc = tmp_path / "test.taskrc" + monkeypatch.setattr(OPTIONS["task_rc"], "default", rc) + return rc + + +class TestRcFile: + def test_taskrc_parsing(self, fake_rc): + fake_rc.write_text(""" + data.location=~/.taskies + notes.dir=/there + notes.ext=yaml + notes.annot=Boo! + notes.editor=micro + notes.quiet=true + """) + rc_cfg = parse_rc(fake_rc) + assert rc_cfg["task_data"] == Path("~/.taskies") + assert rc_cfg["notes_dir"] == Path("/there") + assert rc_cfg["notes_ext"] == "yaml" + assert rc_cfg["notes_annot"] == "Boo!" + assert rc_cfg["notes_editor"] == "micro" + assert rc_cfg["notes_quiet"] is True