Cache validated source generation receipts
This commit is contained in:
parent
529accf858
commit
6253c45a5e
3 changed files with 115 additions and 19 deletions
|
|
@ -422,6 +422,24 @@ class DocForgeCoreTests(unittest.TestCase):
|
|||
):
|
||||
index.get_node("guide.workflow")
|
||||
|
||||
def test_source_generation_receipt_cache_is_signature_bound(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = self.copy_fixture("alpha", Path(directory))
|
||||
project = Project.open(root)
|
||||
ProjectIndex(project).build()
|
||||
first = project.incremental_state()
|
||||
self.assertIsNotNone(first)
|
||||
|
||||
with mock.patch.object(
|
||||
Path,
|
||||
"read_text",
|
||||
side_effect=AssertionError("warm generation check reparsed its receipt"),
|
||||
):
|
||||
self.assertEqual(first, project.incremental_state())
|
||||
|
||||
project.generation_path.write_text("{", encoding="utf-8")
|
||||
self.assertIsNone(project.incremental_state())
|
||||
|
||||
def test_source_set_change_during_load_fails_closed(self) -> None:
|
||||
project = Project.open(FIXTURES / "alpha")
|
||||
sources, directories = project._canonical_inventory()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue