From 53fbe89b652ebf2d0100fb5b9d1d419bceb68d4e Mon Sep 17 00:00:00 2001 From: zhifu gao Date: Tue, 8 Sep 2026 18:41:03 +0000 Subject: [PATCH] test: keep rendering checks in the product-site suite Signed-off-by: zhifu gao --- tests/test_vllm_model_source_docs.py | 21 ------------------- .../product-site/tests/test_documentation.py | 12 +++++++++++ 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/tests/test_vllm_model_source_docs.py b/tests/test_vllm_model_source_docs.py index 12a349d56..ff54c0fe6 100644 --- a/tests/test_vllm_model_source_docs.py +++ b/tests/test_vllm_model_source_docs.py @@ -1,9 +1,7 @@ from pathlib import Path import ast -import importlib.util import pytest -from bs4 import BeautifulSoup ROOT = Path(__file__).resolve().parents[1] @@ -45,25 +43,6 @@ def test_model_selection_moss_alias_matches_real_service_configuration(suffix): assert "verbose_json" in text -@pytest.mark.parametrize("language", ["en", "zh"]) -def test_model_selection_renders_distinct_local_native_and_split_links(language): - spec = importlib.util.spec_from_file_location( - "model_choice_documentation", ROOT / "web-pages/product-site/documentation.py") - documentation = importlib.util.module_from_spec(spec) - spec.loader.exec_module(documentation) - catalogue = documentation.load_catalogue() - entry = next(page for page in catalogue["pages"] if page["slug"] == "model-selection") - rendered = documentation.render_source(entry, language, catalogue) - soup = BeautifulSoup(rendered["content_html"], "html.parser") - prefix = "/en" if language == "en" else "" - targets = {a.get("href") for a in soup.select("a[href]")} - for slug in ("vllm", "official-native-vllm", "native-vllm", "moss-transcribe-diarize"): - assert f"{prefix}/docs/{slug}.html" in targets - ids = [node["id"] for node in soup.select("[id]")] - assert ids.count("vllm-checkpoint-paths") == 1 - assert len(ids) == len(set(ids)), "Existing and new section anchors must stay unique" - - def test_documentation_hub_keeps_official_and_historical_native_entries_separate(): text = (ROOT / "docs/README.md").read_text() for target in ("vllm_official_native_validation.md", "vllm_official_native_validation_zh.md", diff --git a/web-pages/product-site/tests/test_documentation.py b/web-pages/product-site/tests/test_documentation.py index 7f4dc8b11..b165b6746 100644 --- a/web-pages/product-site/tests/test_documentation.py +++ b/web-pages/product-site/tests/test_documentation.py @@ -140,6 +140,18 @@ def test_documentation_links_are_mapped_to_local_pages_or_repository(output): assert href.startswith(('/', '#', 'https://', 'http://', 'mailto:')), href +@pytest.mark.parametrize('prefix', ['', 'en/']) +def test_model_selection_renders_distinct_local_native_and_split_links(output, prefix): + page = BeautifulSoup((output / prefix / 'docs/model-selection.html').read_text(), 'html.parser') + article = page.select_one('.docs-article') + targets = {a['href'] for a in article.select('a[href]')} + for slug in ('vllm', 'official-native-vllm', 'native-vllm', 'moss-transcribe-diarize'): + assert f'/{prefix}docs/{slug}.html' in targets + ids = [node['id'] for node in page.select('[id]')] + assert ids.count('vllm-checkpoint-paths') == 1 + assert len(ids) == len(set(ids)), 'Existing and new section anchors must stay unique' + + def test_source_fragment_links_keep_unicode_and_punctuation_boundaries(output): for prefix in ('', 'en/'): for path in (output / prefix / 'docs').glob('*.html'):