Skip to content

Commit

Permalink
Make tests pass locally
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-dillon committed Oct 2, 2024
1 parent f43280e commit 982ae6a
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from dataclasses import dataclass
import datetime
import random
import sys
import typing as t
import time

Expand Down Expand Up @@ -308,9 +309,16 @@ def index_cache_is_stale() -> bool:

def _get_index(signal_type: t.Type[SignalType]) -> SignalTypeIndex[int] | None:
entry = _get_index_cache().get(signal_type.get_name())

if entry is not None and is_in_pytest():
entry.reload_if_needed(get_storage())

if entry is None:
current_app.logger.debug("[lookup_signal] no cache, loading index")
return get_storage().get_signal_type_index(signal_type)
if entry.is_ready:
return entry.index
return None

def is_in_pytest():
return "pytest" in sys.modules

0 comments on commit 982ae6a

Please sign in to comment.