test: bring the 82 unmarked test files into the offline gate (fix rotted path-prefix + SVG tests) - #4035
Open
kokhlo wants to merge 1 commit into
Open
test: bring the 82 unmarked test files into the offline gate (fix rotted path-prefix + SVG tests)#4035kokhlo wants to merge 1 commit into
kokhlo wants to merge 1 commit into
Conversation
CI's offline job (pytest tests/ -m offline) collected 7,743 of 9,428 tests on c7e7a24; 82 files carried no pytest marker at any level, so no job ever selected them (1,505 tests). All of them run hermetically against mocks/TestClient -- the full unmarked set passes locally with only conditional skips (spaCy models, docling, cairo native library). - mark all 82 files 'offline' via module-level pytestmark, following the repo's existing convention (tests/pipeline/ etc.) - tests/api/test_path_prefixes.py: stage a minimal WebUI build for the two Mount tests -- create_app skips the WebUI mount when the bun build artifacts are absent, so /webui/ answered 307-to-/docs instead of exercising the root_path normalization middleware under test (regressed by 2ea2814; the file predates it and was never run by CI) - tests/api/test_path_prefixes.py: assert the auth challenge on DELETE /documents as 'in (401, 403)' -- the property is 'credentials required'; combined_dependency has answered 403 for a configured API key with none presented since 2ea2814 - tests/parser/markdown/test_parser.py: guard the four real-raster SVG tests on check_svg_rasterizer() -- cairosvg is a cffi binding and raises without native libcairo, which the parser itself treats as an optional capability; mirrors the requires_spacy_models skip - tests/parser/markdown/test_raw_cache.py: patch md_parser._rasterize_svg instead of cairosvg.svg2png in the cache-hit guard so the test no longer imports cairosvg at all Offline selection: 7,743 -> 9,248 collected (+1,505); full run passes. Closes HKUDS#4033 Signed-off-by: kokhlo <konstantin.khlopkov93@gmail.com>
Contributor
Author
|
Cross-linking the claim from #4033 (issuecomment-5757542866): PR is up. Local numbers on top of
The one deliberate non-fix: the 401-vs-403 pair now asserts |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CI's offline gate (
pytest tests/ -m offline) never ran the 91 files the issue found unmarked — onc7e7a24fit collected 7,743 of 9,428 tests. Of those, 82 files (1,505 tests) carried no marker at all, so no CI job selected them in any mode;pytest_collection_modifyitemsonly auto-skipsintegration, so unmarked files are simply invisible.Every one of the 82 files runs hermetically against mocks /
TestClient/ monkeypatching (thepostgres_impl,qdrant_impl,milvus_impl,neo4j_implsuites construct fakes or patch the connection layer; theapi/suites drivecreate_app()withLightRAGmocked). They are markedofflinewith the repo's existing module-levelpytestmark = pytest.mark.offlineconvention. None neededintegration/requires_db— the empirical run of the full unmarked set passes with only conditional skips.Four rotted tests had real causes, all traced to 2ea2814 (2026-08-29) landing after the file was written (08-19) — with CI never running the file, nothing caught the drift:
test_mount_strip_mode_matches,test_mount_verbatim_mode_matches): these exercise theroot_pathnormalization middleware through the WebUIMount. Butcreate_apponly mounts the WebUIStaticFileswhen the bun build artifacts exist; on any bare checkout/CI they don't, so/webui/fell through to the redirect-to-/docsfallback (307) without ever reaching the middleware under test. Fixed by staging a minimalwebui/index.htmlbuild dir + patchingcheck_frontend_build, the same patterntest_workspace_entry_mount.pyalready uses.test_destructive_route_requires_auth_under_a_colliding_prefix[verbatim|strip]):combined_dependencyhas answered403 "API Key required"for "API key configured, none presented" since 2ea2814. The property the test is named for is "requires auth", which holds either way; the assertion is nowin (401, 403)with the reasoning in the docstring. Which single code should be canonical is left as the maintainer's call, per the issue.tests/parser/markdown/into the gate):cairosvgis a cffi binding — the wheel installs but rendering needs nativelibcairo, absent from stock macOS and stockpython:3.12-slim. The parser itself treats this as an optional capability (check_svg_rasterizer()startup probe). The 4 tests that assert on real PNG output now skip on that probe (mirroring therequires_spacy_modelsskip pattern), and the cache-hit guard test patchesmd_parser._rasterize_svginstead of importingcairosvg, so it runs everywhere.Verification
Before (c7e7a24):
uv sync --frozen --extra api --extra offline-storage --extra offline-llm --extra pytestAfter:
The 314 failures are byte-identical on main and on this branch (
tests/setup/*— they shell out toscripts/setup/setup.sh, which hard-requires Bash ≥ 4; macOS dev machines ship 3.2). Zero new failures; +1,384 passing; +121 skips are the new conditional guards (spaCy models, cairo native lib, docling). On CI's ubuntu runners (Bash 5) the setup suite passes, so the offline job is expected to be fully green.The 4 originally-rotted tests plus the SVG set now pass locally (
tests/api/test_path_prefixes.py: 34 passed;tests/parser/markdown/: 44 passed + 4 cairo-skips without libcairo, 48/48 with it).Notes for reviewers
integration/requires_db/requires_api— not touched.combined_dependencyplus these two assertions going back to== 401.Closes #4033