From e55fd0b76ffbf5c81989374be0b1fb71a5a56a7d Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Wed, 11 Nov 2026 15:03:28 +0100 Subject: [PATCH] fix: let a moved page return as part of its target Sega's page passed its budget and was split by console again: systems/sega-dreamcast is once more written, as a part whose parent is systems/sega, the page it had moved to. The redirect already stands aside for a written page. The test now asks the old address to be absent or a part of its target. --- tests/test_site_systems.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_site_systems.py b/tests/test_site_systems.py index 8c3b99157..45131dea5 100644 --- a/tests/test_site_systems.py +++ b/tests/test_site_systems.py @@ -1191,7 +1191,16 @@ class EnginesGoByEngine(unittest.TestCase): self.skipTest("pages not generated") for old, target in gs.SYSTEM_PAGES_MOVED.items(): new = target.partition("#")[0] - self.assertFalse((CONTENT / old).exists() or (CONTENT / old).with_suffix(".mdx").exists(), old) + written = [path for path in (CONTENT / old, (CONTENT / old).with_suffix(".mdx")) + if path.exists()] + # A maker's page split by console again (Sega past its budget) + # writes the old address as one of its parts: the redirect then + # stands aside, and the page names the one it moved to as parent. + for path in written: + parent = re.search(r"^parent:\n label: .*\n link: (\S+)$", + path.read_text(encoding="utf-8"), re.M) + self.assertIsNotNone(parent, old) + self.assertEqual(parent.group(1), "/" + new.removesuffix(".md") + "/", old) # A page with tabs is written as MDX. self.assertTrue((CONTENT / new).exists() or (CONTENT / new).with_suffix(".mdx").exists(), new) redirects = CONTENT.parents[1] / "generated" / "redirects.json"