Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(tests): point unit-test profiles at the maintained Google PSE tests (#6345)

BingEdwardb11e2c5bc02e
diff --git a/tests/infrastructure_tests/test_runner_targets_exist.py b/tests/infrastructure_tests/test_runner_targets_exist.py
new file mode 100644
index 0000000000..3ade4b7de7
--- /dev/null
+++ b/tests/infrastructure_tests/test_runner_targets_exist.py
@@ -0,0 +1,77 @@
+"""Every test path selected by ``tests/run_all_tests.py`` must still exist.
+
+The runner hardcodes its unit-profile selection as string literals. When a
+selected module is deleted or renamed, nothing notices until someone runs the
+profile and pytest exits 4 ("file or directory not found") — which is how
+``tests/test_google_pse.py`` stayed in the ``unit-only``/``ci``/``fast``/
+``standard`` profiles for months after #4275 deleted it (#6304).
+
+These guards run inside the unit profile itself, so the runner now checks its
+own selection on every run.
+"""
+
+# allow: no-sut-import — a guardian over the test runner's own configuration,
+# not over application behaviour.
+
+import re
+from pathlib import Path
+
+import pytest
+
+from tests import run_all_tests
+
+PROJECT_ROOT = Path(run_all_tests.__file__).parent.parent
+
+
+def _unit_test_argv(monkeypatch) -> list[str]:
+ """Capture the argv ``run_unit_tests()`` would hand to pytest."""
+ captured: list[str] = []
+
+ # pdm need not be installed to check which paths the runner selects.
+ monkeypatch.setattr(run_all_tests, "find_exe", lambda name: Path(name))
+
+ def fake_run_command(cmd, name, **kwargs):
+ captured.extend(str(c) for c in cmd)
+ return True
+
+ runner = run_all_tests.TestRunner()
+ monkeypatch.setattr(runner, "run_command", fake_run_command)
+ assert runner.run_unit_tests() is True
+ return captured
+
+
+def test_unit_profile_targets_exist(monkeypatch):
+ """No selected path may be missing — pytest exits 4 on the first one."""
+ targets = [
+ arg for arg in _unit_test_argv(monkeypatch) if arg.startswith("tests/")
+ ]
+ assert targets, "run_unit_tests() selected no test paths at all"
+
+ missing = [t for t in targets if not (PROJECT_ROOT / t).exists()]
+ assert not missing, f"run_unit_tests() selects nonexistent paths: {missing}"
+
+
+def test_unit_profile_still_covers_google_pse(monkeypatch):
+ """#6304: the fix must not degrade into dropping the coverage."""
+ targets = _unit_test_argv(monkeypatch)
+ assert [t for t in targets if "google_pse" in t], (
+ "run_unit_tests() no longer selects any Google PSE test module"
+ )
+
+
+ "target",
+ sorted(
+ set(
+ re.findall(
+ r'"(tests/[^"*?\s]+)"',
+ Path(run_all_tests.__file__).read_text(encoding="utf-8"),
+ )
+ )
+ ),
+)
+def test_every_runner_path_literal_exists(target):
+ """Also cover the profiles that cannot run without a live server."""
+ assert (PROJECT_ROOT / target).exists(), (
+ f"run_all_tests.py references {target!r}, which does not exist"
+ )
diff --git a/tests/run_all_tests.py b/tests/run_all_tests.py
index fa4c482331..725432f661 100755
--- a/tests/run_all_tests.py
+++ b/tests/run_all_tests.py
@@ -355,7 +355,12 @@ class TestRunner:
"pytest",
"-v", # Verbose output
"tests/test_settings_manager.py",
- "tests/test_google_pse.py",
+ # Google PSE: tests/test_google_pse.py was deleted in #4275 as a
+ # mock-identity tautology; these are the maintained replacements.
+ "tests/search_engines/test_search_engine_google_pse.py",
+ "tests/web_search_engines/engines/test_search_engine_google_pse.py",
+ "tests/web_search_engines/engines/test_search_engine_google_pse_coverage.py",
+ "tests/web_search_engines/engines/test_search_engine_google_pse_extra_coverage.py",
"tests/test_wikipedia_url_security.py",
"tests/test_search_engines_enhanced.py",
"tests/test_utils.py",