from unittest.mock import Mock, patch

import pytest


@pytest.fixture(autouse=True)
def mock_rate_tracker():
    """Mock rate tracker for all engine unit tests."""
    mock_tracker = Mock()
    mock_tracker.enabled = False
    mock_tracker.apply_rate_limit.return_value = 0.0
    mock_tracker.get_wait_time.return_value = 0.0
    mock_tracker.record_outcome.return_value = None
    with patch(
        "local_deep_research.web_search_engines.search_engine_base.get_tracker",
        return_value=mock_tracker,
    ):
        yield mock_tracker
