diff --git a/tests/integration/defs/test_doc.py b/tests/integration/defs/test_doc.py index 997e793d38a3..a067cae63ddc 100644 --- a/tests/integration/defs/test_doc.py +++ b/tests/integration/defs/test_doc.py @@ -38,6 +38,16 @@ "ATTRIBUTIONS-CPP-aarch64.md", } +# Repository-relative Sphinx pages that docs/source/helper.py generates at build +# time via its write_index() calls. They are gitignored (see .gitignore +# "docs/source/**/*.rst"), so a link to one is correct even though it resolves to +# nothing in a source checkout. +SPHINX_GENERATED_DOC_PAGES = { + "docs/source/examples/llm_api_examples.rst", + "docs/source/examples/trtllm_serve_examples.rst", + "docs/source/examples/visual_gen_examples.rst", +} + # URLs that return 404 at HTTP level but are valid in a browser # (e.g., GitHub Pages sites using JS redirects) EXCEPTION_URLS = [ @@ -146,9 +156,23 @@ def _clean_markdown_destination(destination): return destination.strip() +def _is_python_environment(dirnames, filenames): + """Return whether a directory is the root of an installed Python environment. + + Environments vendor third-party markdown whose relative links describe the + upstream source tree, not this repository, so they must not be validated. + Name-based pruning alone misses environments created under an arbitrary name + (e.g. CI scratch dirs), hence these layout markers. + """ + return "pyvenv.cfg" in filenames or "site-packages" in dirnames + + def _find_markdown_files(root_dir): markdown_files = [] for dirpath, dirnames, filenames in os.walk(root_dir): + if _is_python_environment(dirnames, filenames): + dirnames[:] = [] + continue # Prune in-place so os.walk doesn't descend into skipped dirs. dirnames[:] = [ d for d in dirnames if d not in SKIP_DIR_NAMES and not d.startswith(SKIP_DIR_PREFIXES) @@ -223,7 +247,14 @@ def _check_relative_repository_link(url_info, source_file, root_dir): candidate_paths = [local_path] if not os.path.splitext(local_path)[1]: candidate_paths.extend((f"{local_path}.md", f"{local_path}.rst")) - is_valid = any(os.path.exists(candidate_path) for candidate_path in candidate_paths) + + is_valid = any( + os.path.exists(candidate_path) + # Generated pages are absent from a source checkout, so treat a link to + # one as resolved rather than dangling. + or os.path.relpath(candidate_path, root_dir) in SPHINX_GENERATED_DOC_PAGES + for candidate_path in candidate_paths + ) reason = f"Repository path {'exists' if is_valid else 'not found'}: {local_path}" return is_valid, url, line_num, reason diff --git a/tests/integration/test_lists/waives.txt b/tests/integration/test_lists/waives.txt index 282db18fe40a..48b1f80a14fd 100644 --- a/tests/integration/test_lists/waives.txt +++ b/tests/integration/test_lists/waives.txt @@ -189,7 +189,6 @@ full:RTX_PRO_6000_Blackwell_Server_Edition/accuracy/test_llm_api_pytorch.py::Tes full:sm100/unittest/bindings SKIP (Disable for Blackwell) perf/test_perf_sanity.py::test_e2e[disagg_upload-e2e-gb300_deepseek-v4-pro-dspark_agentx_con1156_ctx2_dep8_gen1_dep8_eplb0_dspark3_ccb-NIXL] SKIP (https://nvbugs/6877254) perf/test_visual_gen_perf_sanity.py::test_visual_gen_e2e[vg_upload-flux2_blackwell-flux2_fp8_cfg1_ulysses4_teacache_on] SKIP (https://nvbugs/6759009) -test_doc.py::test_relative_path_validity SKIP (https://nvbugs/6784181) test_e2e.py::test_ptp_quickstart_advanced[Nemotron-Nano-9B-v2-nvfp4-NVIDIA-Nemotron-Nano-9B-v2-NVFP4] SKIP (https://nvbugs/6624972) test_e2e.py::test_ptp_quickstart_bert[TRTLLM-BertForSequenceClassification-bert/bert-base-uncased-yelp-polarity] SKIP (https://nvbugs/6605819) test_e2e.py::test_ptp_quickstart_bert[VANILLA-BertForSequenceClassification-bert/bert-base-uncased-yelp-polarity] SKIP (bug pending, tracked in PR 17414)