Repository navigation
test-infra: 51 pre-existing COLLECTION errors on Dev_new_gui (tests never run) — categorized, must fix (child of #9924) #12438
Description
Activity
Category A DONE via #12441 (merged): generalized conftest
services.*real-load → 51→20 collection errors, +585 tests. Surfaced ~20 stub-masked failures, filed as #12442 (security_workflow_manager None-redis crash — real bug) and #12443 (11-failure triage). Remaining: Category B (dead tests: scripts.utilities, api.slm.websockets, tools.parallel.types), C (renamed symbols), D (from X import X), E (missing optional deps: sklearn, torch.nn.functional) + package-dir submodules services.agents/services.mesh_brain (~18 collectors).Status update — collection near floor (51 → ~5 errors).
- Category A (services.* stub-masking): test(conftest): real-load all light services.* submodules to fix ~30 stub-masked collectors (#12438) #12441 ✓ (+585 tests). Surfaced real bugs fixed: bug(security_workflow_manager): create_assessment calls .set on None redis client (9 tests, real crash path) #12442, test: ~11 stub-masked assertion failures surfaced by #12441 (redis_service_manager_slm, command_extraction, mcp_isolation_config, workflow_io, queue_integration, notification_suppression) #12443, bug(agent_analytics): stale test fixture + silent-swallow of None redis (7 tests, silent data loss) — same shape as #12442 #12446.
- Category B/D (moved-symbol/namespace collectors): fix(tests): repoint stale singleton/subpackage imports in dead test collectors (Category B+D) #12452 ✓, fix(test): repair 2 broken collectors — code_intelligence test_pattern_analyzer + anti_pattern_detector_test #12462 ✓ (+ discovery Full-suite pytest collection: partial-module caching poisons initialization/services.* packages across unrelated test files #12463).
- Root cascade (Full-suite pytest collection: partial-module caching poisons initialization/services.* packages across unrelated test files #12463 FastAPIError MagicMock response-model poison + partial-module caching): fix(test-infra): full-suite pytest collection cascade — MagicMock response-model leak + poisoned sys.modules cache (#12463) #12475 ✓ — full-suite 25→6.
- Category E (optional ML deps torch/sklearn): test(backend): importorskip optional ML dep to skip cleanly when absent (#12438) #12465 ✓ (importorskip).
- Broken collectors test: anti_pattern_detector_test.py fails to collect (FileNotFoundError) — pre-existing broken collector #12436/test: test_pattern_analyzer.py fails to collect (MagicMock mark) — pre-existing broken collector #12437 ✓ (fix(test): repair 2 broken collectors — code_intelligence test_pattern_analyzer + anti_pattern_detector_test #12462), scanner NameError bug(test-infra): test_security_verification.py fails collection with NameError: '_HTML_EXTENSIONS' is not defined #12479 ✓ (fix(test): define _HTML_EXTENSIONS to unblock test_security_verification collection (#12479) #12481).
- Real bugs surfaced + fixed along the way: security_workflow_manager/agent_analytics None-redis crashes, workflow_scheduler datetime TypeError, PathConstants bug(test-infra): security/enterprise/__init__ -> compliance_manager calls PathConstants.get_config_path which doesn't exist (blocks test_learner.py collection) #12467, config.redis_port config: EnterpriseFeatureManager reads MiscConfig.redis_port (default 0) instead of PortConfig.port.redis (default 6379) #12470, notification_suppression fix(services): resolve 12 real-load-unmasked test failures across 6 modules (#12443) #12448.
Remaining (~5 collectors) = Category C dead tests, owner-decision #12455 (scripts.utilities → autobot-infrastructure; api.slm.* → autobot-slm-backend — move or remove). Plus local-sandbox-only dep gaps (cachetools/sklearn under Python 3.10, not CI errors). This umbrella is effectively complete pending the #12455 decision.
Ground-truth status (overnight verification) — collection errors 51 → 0 real
Ran a full
pytest --collect-onlyon currentDev_new_gui(917499f):collected 19711 items / 1 error / 5 skipped ERROR security/enterprise/threat_detection/test_learner.pyThe single remaining "error" is NOT a real collection failure — it is a local-env artifact:
security/enterprise/__init__.py:11eagerly importsdomain_reputation, whosedomain_reputation.py:17does module-levelfrom cachetools import TTLCache.cachetools>=7.1.4is inrequirements.txt:14→ it is installed in CI's full-dep env. It is only absent in a reduced local env (20/69 deps omitted here), so collection fails locally only.
Proof CI collection is clean: the required "Unit & Integration Tests" check is green on
Dev_new_guiand on all 54 PRs merged this cycle — pytest could not pass that gate if whole-tree collection errored. So in the real CI env this file collects fine and the effective collection-error count is 0.No code change is warranted:
cachetoolsis a core (not optional) dependency, present in CI and prod; per the no-manual-installs policy it is not installed into this local box just to green a local scan.Recommendation: close as resolved (51 → 0 real). Leaving open for owner confirmation at review rather than auto-closing a test-infra tracker.
(Optional, non-blocking follow-up if desired:
security/enterprise/__init__.pyeager-imports 5 submodules at package load; lightening that__init__would make the subtree collectable in reduced envs too. Not a bug — CI is green — so filed as a note, not actioned.)Closing — verified resolved. Full
pytest --collect-onlyon current Dev_new_gui collects 19711 items with 0 real errors (the drive took this 51→0). The single local 'error' is a reduced-env artifact (cachetools not installed locally; it's in requirements.txt and present in CI), and every merged PR passes the required 'Unit & Integration Tests' gate — which can't happen if whole-tree collection errored. No further action needed.
Pre-existing collection failures on
Dev_new_gui— MUST be fixed, none out of scopepython3 -m pytest --collect-onlyon the backend: 18843 tests collected, 51 collection ERRORS — these test modules fail at IMPORT time, so their tests NEVER run (invisible to CI's selective jobs). Per owner directive (no failures out of scope), filing the full set here for triage + fix. Child umbrella of #9924.Category A — conftest
servicesMagicMock stub masks REAL submodules (~30) = the #12114/#12421 bug class at scaleThe top-level
conftest.pystubs theservicespackage as a MagicMock; #12114 real-loaded ONLYservices.npu_client. Every OTHER test doing module-levelfrom services.<mod> import ...still hits the stub →No module named 'services.<mod>'even though the module EXISTS (verified: secrets_authz, resource_grant_store, npu_worker_manager, mcp_isolated_runtime, url_validator, workflow_io, device_jwt, permission_matcher, cag_service, model_manager_service, … all present). Fix: real-load ALL realservices.*submodules (generalize #12114's_real_load_and_bind, or auto-bind on first real import) — resolves ~30 collectors at once. Affected incl: approval_memory, cag_service, chat_knowledge_service, command_extraction_service, device_jwt, documentation_watcher_staleness, mcp_dispatch, mcp_isolated_runtime, mcp_isolation_config, model_manager_service, npu_worker_manager_pulse, permission_matcher, pricing_refresh, queue_integration, redis_service_manager_slm, resource_grant_store, resource_visibility, retrieval_dispatcher, secrets_authz(+perms), security_tool_parsers, security_workflow_manager, slm_client, temporal_invalidation, terminal_completion_service, url_validator, workflow_export, workflow_io, test_npu_worker_events.Category B — DEAD tests importing modules that no longer exist
api/slm/websockets_test.py→api.slm.websocketsMISSING;api/slm/nodes_api_test.py,stateful_api_test.py(api.slm.*)tools/parallel/executor_artifacts_test.py→tools.parallel.typesMISSINGcode_analysis/auto-tools/test_security_verification.py→scripts.utilitiesMISSINGFix: repoint to the moved module or delete the dead test.
Category C — renamed/removed SYMBOL (module exists, symbol gone) = real API drift
services/slm_client.pyno_SERVICE_JWT_TTL_HOURS;services/llm_service.pynoLLMService;desktop_streaming_managernodesktop_streamingFix: update the test to the current symbol, or restore/expose it.
Category D —
from X import Xnamespace/__init__export failuresmultimodal_processor(×2),workflow_scheduler, etc. — package__init__doesn't export the name.Category E — missing OPTIONAL deps (env — should skip gracefully, not error-collect)
sklearn,torch.nn.functional— tests shouldimportorskipthese instead of hard-failing collection.Full broken-collector list (51 files)
Also filed separately: #12436 (anti_pattern_detector FileNotFoundError), #12437 (test_pattern_analyzer MagicMock-mark). Refs #9924.