Initial import of NousResearch/hermes-agent
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
Docker / shell lint / Lint Dockerfile (hadolint) (push) Has been cancelled
Docker / shell lint / Lint docker/ shell scripts (shellcheck) (push) Has been cancelled
Docker Build and Publish / build-amd64 (push) Has been cancelled
Docker Build and Publish / build-arm64 (push) Has been cancelled
Lint (ruff + ty) / ruff + ty diff (push) Has been cancelled
Lint (ruff + ty) / ruff enforcement (blocking) (push) Has been cancelled
Lint (ruff + ty) / Windows footguns (blocking) (push) Has been cancelled
Nix Lockfile Fix / auto-fix-main (push) Has been cancelled
Nix Lockfile Fix / fix (push) Has been cancelled
Nix / nix (macos-latest) (push) Has been cancelled
Nix / nix (ubuntu-latest) (push) Has been cancelled
OSV-Scanner / Scan lockfiles (push) Has been cancelled
Build Skills Index / build-index (push) Has been cancelled
Tests / test (1) (push) Has been cancelled
Tests / test (2) (push) Has been cancelled
Tests / test (3) (push) Has been cancelled
Tests / test (4) (push) Has been cancelled
Tests / test (5) (push) Has been cancelled
Tests / test (6) (push) Has been cancelled
Tests / e2e (push) Has been cancelled
uv.lock check / uv lock --check (push) Has been cancelled
Docker Build and Publish / merge (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
Tests / save-durations (push) Has been cancelled
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
Docker / shell lint / Lint Dockerfile (hadolint) (push) Has been cancelled
Docker / shell lint / Lint docker/ shell scripts (shellcheck) (push) Has been cancelled
Docker Build and Publish / build-amd64 (push) Has been cancelled
Docker Build and Publish / build-arm64 (push) Has been cancelled
Lint (ruff + ty) / ruff + ty diff (push) Has been cancelled
Lint (ruff + ty) / ruff enforcement (blocking) (push) Has been cancelled
Lint (ruff + ty) / Windows footguns (blocking) (push) Has been cancelled
Nix Lockfile Fix / auto-fix-main (push) Has been cancelled
Nix Lockfile Fix / fix (push) Has been cancelled
Nix / nix (macos-latest) (push) Has been cancelled
Nix / nix (ubuntu-latest) (push) Has been cancelled
OSV-Scanner / Scan lockfiles (push) Has been cancelled
Build Skills Index / build-index (push) Has been cancelled
Tests / test (1) (push) Has been cancelled
Tests / test (2) (push) Has been cancelled
Tests / test (3) (push) Has been cancelled
Tests / test (4) (push) Has been cancelled
Tests / test (5) (push) Has been cancelled
Tests / test (6) (push) Has been cancelled
Tests / e2e (push) Has been cancelled
uv.lock check / uv lock --check (push) Has been cancelled
Docker Build and Publish / merge (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
Tests / save-durations (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
"""Shared fixtures for tests/tools/ web-provider tests.
|
||||
|
||||
Per-file subprocess isolation means each test file gets a fresh interpreter,
|
||||
so module-level state (like the web-search-provider registry) is empty when
|
||||
a file starts. The ``web_registry_populated`` fixture registers all bundled
|
||||
providers before each test and resets the registry afterwards — tests that
|
||||
depend on the registry being populated should use it explicitly or via
|
||||
``@pytest.mark.usefixtures("web_registry_populated")``.
|
||||
"""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def register_all_web_providers():
|
||||
"""Register all bundled web-search providers into the global registry.
|
||||
|
||||
This is the single source of truth for the provider list used by
|
||||
test classes that need the registry populated for dispatch checks.
|
||||
"""
|
||||
from agent.web_search_registry import register_provider, _reset_for_tests
|
||||
from plugins.web.brave_free.provider import BraveFreeWebSearchProvider
|
||||
from plugins.web.ddgs.provider import DDGSWebSearchProvider
|
||||
from plugins.web.exa.provider import ExaWebSearchProvider
|
||||
from plugins.web.firecrawl.provider import FirecrawlWebSearchProvider
|
||||
from plugins.web.parallel.provider import ParallelWebSearchProvider
|
||||
from plugins.web.searxng.provider import SearXNGWebSearchProvider
|
||||
from plugins.web.tavily.provider import TavilyWebSearchProvider
|
||||
from plugins.web.xai.provider import XAIWebSearchProvider
|
||||
|
||||
_reset_for_tests()
|
||||
for cls in (
|
||||
BraveFreeWebSearchProvider,
|
||||
DDGSWebSearchProvider,
|
||||
ExaWebSearchProvider,
|
||||
FirecrawlWebSearchProvider,
|
||||
ParallelWebSearchProvider,
|
||||
SearXNGWebSearchProvider,
|
||||
TavilyWebSearchProvider,
|
||||
XAIWebSearchProvider,
|
||||
):
|
||||
register_provider(cls())
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def web_registry_populated():
|
||||
"""Populate the web-search-provider registry for one test, then reset."""
|
||||
register_all_web_providers()
|
||||
yield
|
||||
from agent.web_search_registry import _reset_for_tests
|
||||
_reset_for_tests()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def disable_lazy_stt_install():
|
||||
"""Disarm the runtime lazy-install probe so static ``_HAS_FASTER_WHISPER``
|
||||
patches accurately simulate 'faster-whisper not installed'.
|
||||
|
||||
Without this, ``_try_lazy_install_stt()`` calls
|
||||
``importlib.util.find_spec("faster_whisper")``, which returns truthy
|
||||
whenever the package is installed in the dev / CI environment —
|
||||
defeating the test's ``_HAS_FASTER_WHISPER=False`` patch.
|
||||
|
||||
Opt in at module scope with
|
||||
``pytestmark = pytest.mark.usefixtures("disable_lazy_stt_install")``.
|
||||
"""
|
||||
with patch("tools.transcription_tools._try_lazy_install_stt", return_value=False):
|
||||
yield
|
||||
Reference in New Issue
Block a user