mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 01:57:48 -06:00
fix: find generated pages through sitepages
test_release_packs looked for platforms/knulli.md, but the page is knulli.mdx, so test_a_built_setup_page_has_the_line always skipped, in CI too. Under the skip it asserted text the generator never writes: the glossary wraps ZIP in an <abbr>, and the heading is '## On the device { #install }', not '## Install'. It now reads the page through sitepages.page() after sitepages.require(), strips the glossary markup and looks for the #install heading. The single-page helpers of test_site_reference and test_site_emulators go through sitepages too, so a missing page fails in CI instead of skipping or reading as empty.
This commit is contained in:
1 parent
a58ca7bf6b
commit
d73afff852
3 files changed
+14
-22
No files matched your search
@@ -14,11 +14,13 @@ platform has a permanent page at get/<platform>/ instead.
|
||||
from __future__ import annotations
|
||||
|
||||
import tests
|
||||
from tests import sitepages
|
||||
from tests.sources import script_source
|
||||
|
||||
import contextlib
|
||||
import io
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
@@ -270,13 +272,14 @@ class EverySurfaceSaysWhy(unittest.TestCase):
|
||||
self.assertNotIn("yet", block)
|
||||
|
||||
def test_a_built_setup_page_has_the_line(self):
|
||||
page = REPO_ROOT / "website" / "src" / "content" / "docs" / "platforms" / "knulli.md"
|
||||
if not page.is_file():
|
||||
self.skipTest("the site is not generated")
|
||||
text = page.read_text(encoding="utf-8")
|
||||
sitepages.require()
|
||||
page = sitepages.page("platforms/knulli.md").read_text(encoding="utf-8")
|
||||
# The glossary wraps the first ZIP of the page in an <abbr>.
|
||||
text = re.sub(r"<abbr[^>]*>(.*?)</abbr>", r"\1", page)
|
||||
self.assertIn("No ZIP for KNULLI. The command installs every file and checks it.", text)
|
||||
install = text.index("## Install")
|
||||
self.assertLess(install, text.index("No ZIP for KNULLI"))
|
||||
install = re.search(r"(?m)^## (?:Install|.+ \{ #install \})$", text)
|
||||
self.assertIsNotNone(install)
|
||||
self.assertLess(install.start(), text.index("No ZIP for KNULLI"))
|
||||
|
||||
def test_get_your_files_explains_the_rows(self):
|
||||
page = _which_pack()
|
||||
|
||||
@@ -28,6 +28,7 @@ Linux, Windows and Android commands, for MAME4droid an Android-only app.
|
||||
from __future__ import annotations
|
||||
|
||||
import tests
|
||||
from tests import sitepages
|
||||
|
||||
import re
|
||||
import unittest
|
||||
@@ -566,11 +567,7 @@ def _profiles_with_data_root() -> dict[str, dict]:
|
||||
|
||||
|
||||
def _built_page(name: str) -> str:
|
||||
for suffix in (".mdx", ".md"):
|
||||
path = EMULATORS / f"{name}{suffix}"
|
||||
if path.exists():
|
||||
return path.read_text(encoding="utf-8")
|
||||
return ""
|
||||
return sitepages.page(f"emulators/{name}.md").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def _generated() -> bool:
|
||||
@@ -816,8 +813,6 @@ class AnEmulatorPageNamesItsSetups(unittest.TestCase):
|
||||
self.assertEqual(emulatorcards.emulator_setups(coverages, profiles)["handy"], ["a", "b"])
|
||||
|
||||
def test_the_page_names_them(self):
|
||||
from tests import sitepages
|
||||
|
||||
sitepages.require()
|
||||
text = sitepages.page("emulators/handy.md").read_text(encoding="utf-8")
|
||||
row = next(line for line in text.splitlines() if line.startswith("| Run by |"))
|
||||
|
||||
@@ -32,6 +32,7 @@ it has not been generated.
|
||||
from __future__ import annotations
|
||||
|
||||
import tests
|
||||
from tests import sitepages
|
||||
from tests.sources import script_source
|
||||
|
||||
import csv
|
||||
@@ -978,14 +979,6 @@ class SourceLinksGoWhereTheFileIs(unittest.TestCase):
|
||||
DOCS = REPO_ROOT / "website" / "src" / "content" / "docs"
|
||||
|
||||
|
||||
def _page(stem: str) -> str:
|
||||
for suffix in (".md", ".mdx"):
|
||||
path = DOCS / f"{stem}{suffix}"
|
||||
if path.is_file():
|
||||
return path.read_text(encoding="utf-8")
|
||||
raise unittest.SkipTest(f"{stem} not generated")
|
||||
|
||||
|
||||
class LookupRecordsUnderEveryHash(unittest.TestCase):
|
||||
"""8.1: a platform listing a file by MD5 is found by its SHA1 too."""
|
||||
|
||||
@@ -1274,7 +1267,8 @@ class NoEmptyCoreTable(unittest.TestCase):
|
||||
_built(DOCS / "cross-reference.md")
|
||||
for name in ("misterfpga", "bizhawk"):
|
||||
self.assertFalse((DOCS / f"cross-reference-{name}.md").exists())
|
||||
self.assertIn(platformpage.OWN_LIST_ONLY, _page(f"platforms/{name}"))
|
||||
page = sitepages.page(f"platforms/{name}.md").read_text(encoding="utf-8")
|
||||
self.assertIn(platformpage.OWN_LIST_ONLY, page)
|
||||
redirects = json.loads((REPO_ROOT / "website" / "src" / "generated" /
|
||||
"redirects.json").read_text())
|
||||
self.assertEqual(redirects.get("/cross-reference-misterfpga/"), "/platforms/misterfpga/")
|
||||
|
||||
Reference in new issue
Block a user