1717import time
1818from collections import Counter
1919from datetime import timedelta
20+ from pathlib import Path
2021from types import SimpleNamespace
22+ from typing import Any , Generator
2123from unittest .mock import AsyncMock , MagicMock , patch
2224
2325import pytest
@@ -903,7 +905,7 @@ def test_get_online_features_serves_non_finite_float(store_and_client, non_finit
903905
904906
905907@pytest .fixture
906- def push_store (tmp_path ) :
908+ def push_store (tmp_path : Path ) -> Generator [ FeatureStore , None , None ] :
907909 store = _build_push_feature_store (tmp_path )
908910 try :
909911 yield store
@@ -912,19 +914,19 @@ def push_store(tmp_path):
912914
913915
914916@pytest .fixture
915- def mock_timer ():
917+ def mock_timer () -> Generator [ MagicMock , None , None ] :
916918 """Captures registry refresh timers so a test can fire them by hand."""
917919 with patch ("feast.feature_server.threading.Timer" ) as mock_timer :
918920 yield mock_timer
919921
920922
921- def _fire_scheduled_refresh (mock_timer ) :
923+ def _fire_scheduled_refresh (mock_timer : MagicMock ) -> None :
922924 mock_timer .call_args .args [1 ]()
923925
924926
925927def test_periodic_registry_refresh_keeps_running_after_a_failure (
926- push_store , mock_timer , caplog
927- ):
928+ push_store : FeatureStore , mock_timer : MagicMock , caplog : pytest . LogCaptureFixture
929+ ) -> None :
928930 """A failed periodic refresh must not stop later refreshes."""
929931 with (
930932 patch .object (
@@ -949,8 +951,8 @@ def test_periodic_registry_refresh_keeps_running_after_a_failure(
949951
950952
951953def test_registry_refresh_failure_at_startup_still_fails_startup (
952- push_store , mock_timer
953- ):
954+ push_store : FeatureStore , mock_timer : MagicMock
955+ ) -> None :
954956 """A failed first refresh must fail app startup."""
955957 with (
956958 patch .object (
@@ -967,13 +969,13 @@ def test_registry_refresh_failure_at_startup_still_fails_startup(
967969
968970
969971def test_registry_refresh_timer_scheduled_during_shutdown_is_cancelled (
970- push_store , mock_timer
971- ):
972+ push_store : FeatureStore , mock_timer : MagicMock
973+ ) -> None :
972974 """Shutdown must cancel a refresh timer that is scheduled while it runs."""
973975 scheduling = threading .Event ()
974- timers = []
976+ timers : list [ MagicMock ] = []
975977
976- def make_timer (* args , ** kwargs ) :
978+ def make_timer (* args : Any , ** kwargs : Any ) -> MagicMock :
977979 timer = MagicMock ()
978980 timers .append (timer )
979981 if len (timers ) == 2 :
0 commit comments