|
@@ -340,6 +340,9 @@ class AppHarness:
|
|
|
|
|
|
This is necessary when the backend is restarted and the state manager is a
|
|
|
StateManagerRedis instance.
|
|
|
+
|
|
|
+ Raises:
|
|
|
+ RuntimeError: when the state manager cannot be reset
|
|
|
"""
|
|
|
if (
|
|
|
self.app_instance is not None
|
|
@@ -354,7 +357,8 @@ class AppHarness:
|
|
|
self.app_instance._state_manager = StateManagerRedis.create(
|
|
|
state=self.app_instance.state,
|
|
|
)
|
|
|
- assert isinstance(self.app_instance.state_manager, StateManagerRedis)
|
|
|
+ if not isinstance(self.app_instance.state_manager, StateManagerRedis):
|
|
|
+ raise RuntimeError("Failed to reset state manager.")
|
|
|
|
|
|
def _start_frontend(self):
|
|
|
# Set up the frontend.
|
|
@@ -787,13 +791,13 @@ class AppHarness:
|
|
|
Raises:
|
|
|
RuntimeError: when the app hasn't started running
|
|
|
TimeoutError: when the timeout expires before any states are seen
|
|
|
+ ValueError: when the state_manager is not a memory state manager
|
|
|
"""
|
|
|
if self.app_instance is None:
|
|
|
raise RuntimeError("App is not running.")
|
|
|
state_manager = self.app_instance.state_manager
|
|
|
- assert isinstance(
|
|
|
- state_manager, (StateManagerMemory, StateManagerDisk)
|
|
|
- ), "Only works with memory state manager"
|
|
|
+ if not isinstance(state_manager, (StateManagerMemory, StateManagerDisk)):
|
|
|
+ raise ValueError("Only works with memory or disk state manager")
|
|
|
if not self._poll_for(
|
|
|
target=lambda: state_manager.states,
|
|
|
timeout=timeout,
|