(tmp_path)
| 151 | |
| 152 | |
| 153 | def test_global_remove(tmp_path): |
| 154 | src_graph = tmp_path / "graph.json" |
| 155 | G = _make_graph([{"id": "userservice", "label": "UserService", "source_file": "src/user.py"}]) |
| 156 | _graph_to_json(G, src_graph) |
| 157 | |
| 158 | global_dir = tmp_path / ".graphify" |
| 159 | with patch("graphify.global_graph._GLOBAL_DIR", global_dir), \ |
| 160 | patch("graphify.global_graph._GLOBAL_GRAPH", global_dir / "global-graph.json"), \ |
| 161 | patch("graphify.global_graph._GLOBAL_MANIFEST", global_dir / "global-manifest.json"): |
| 162 | from graphify.global_graph import global_add, global_remove |
| 163 | global_add(src_graph, "repoA") |
| 164 | removed = global_remove("repoA") |
| 165 | |
| 166 | assert removed > 0 |
| 167 | # manifest should no longer list repoA - need to re-patch for list call |
| 168 | global_dir2 = global_dir # same dir |
| 169 | with patch("graphify.global_graph._GLOBAL_DIR", global_dir2), \ |
| 170 | patch("graphify.global_graph._GLOBAL_GRAPH", global_dir2 / "global-graph.json"), \ |
| 171 | patch("graphify.global_graph._GLOBAL_MANIFEST", global_dir2 / "global-manifest.json"): |
| 172 | from graphify.global_graph import global_list |
| 173 | repos = global_list() |
| 174 | assert "repoA" not in repos |
| 175 | |
| 176 | |
| 177 | def test_global_remove_unknown_tag_raises(tmp_path): |
nothing calls this directly
no test coverage detected