personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

tests: isolate temporary talent prompt fixtures

+14 -6
+14 -6
tests/test_generators.py
··· 138 138 assert sources.get("percepts") is True, "sense should include percepts" 139 139 140 140 141 - def _write_temp_talent_prompt(stem: str, frontmatter: str) -> Path: 142 - talent_dir = Path(__file__).resolve().parent.parent / "talent" 141 + def _write_temp_talent_prompt(talent_dir: Path, stem: str, frontmatter: str) -> Path: 142 + talent_dir.mkdir(parents=True, exist_ok=True) 143 143 prompt_path = talent_dir / f"{stem}.md" 144 144 prompt_path.write_text( 145 145 f"{frontmatter}\n\nTemporary test prompt\n", encoding="utf-8" ··· 147 147 return prompt_path 148 148 149 149 150 - def test_get_talent_configs_raises_on_missing_type_with_output(): 150 + def test_get_talent_configs_raises_on_missing_type_with_output(tmp_path, monkeypatch): 151 151 talent = importlib.import_module("think.talent") 152 + monkeypatch.setattr(talent, "TALENT_DIR", tmp_path) 152 153 stem = f"test_missing_type_output_{uuid.uuid4().hex}" 153 154 prompt_path = _write_temp_talent_prompt( 155 + tmp_path, 154 156 stem, 155 157 '{\n "schedule": "daily",\n "priority": 10,\n "output": "md"\n}', 156 158 ) ··· 163 165 prompt_path.unlink(missing_ok=True) 164 166 165 167 166 - def test_get_talent_configs_allows_missing_type_with_tools(): 168 + def test_get_talent_configs_allows_missing_type_with_tools(tmp_path, monkeypatch): 167 169 talent = importlib.import_module("think.talent") 170 + monkeypatch.setattr(talent, "TALENT_DIR", tmp_path) 168 171 stem = f"test_missing_type_tools_{uuid.uuid4().hex}" 169 172 prompt_path = _write_temp_talent_prompt( 173 + tmp_path, 170 174 stem, 171 175 '{\n "schedule": "daily",\n "priority": 10,\n "tools": "journal"\n}', 172 176 ) ··· 178 182 prompt_path.unlink(missing_ok=True) 179 183 180 184 181 - def test_get_talent_configs_raises_when_generate_missing_output(): 185 + def test_get_talent_configs_raises_when_generate_missing_output(tmp_path, monkeypatch): 182 186 talent = importlib.import_module("think.talent") 187 + monkeypatch.setattr(talent, "TALENT_DIR", tmp_path) 183 188 stem = f"test_generate_missing_output_{uuid.uuid4().hex}" 184 189 prompt_path = _write_temp_talent_prompt( 190 + tmp_path, 185 191 stem, 186 192 '{\n "type": "generate",\n "schedule": "daily",\n "priority": 10\n}', 187 193 ) ··· 195 201 prompt_path.unlink(missing_ok=True) 196 202 197 203 198 - def test_get_talent_configs_allows_cogitate_without_tools(): 204 + def test_get_talent_configs_allows_cogitate_without_tools(tmp_path, monkeypatch): 199 205 talent = importlib.import_module("think.talent") 206 + monkeypatch.setattr(talent, "TALENT_DIR", tmp_path) 200 207 stem = f"test_cogitate_missing_tools_{uuid.uuid4().hex}" 201 208 prompt_path = _write_temp_talent_prompt( 209 + tmp_path, 202 210 stem, 203 211 '{\n "type": "cogitate",\n "schedule": "daily",\n "priority": 10\n}', 204 212 )