Skip to content

Commit

Permalink
tests: added option to not start ProbeModule immediately on construction
Browse files Browse the repository at this point in the history
Signed-off-by: Valentin Dimov <[email protected]>
  • Loading branch information
valentin-dimov committed Nov 10, 2023
1 parent f4f4b12 commit 7585b3e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions everest-testing/src/everest/testing/core_utils/probe_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ProbeModule:
but you do not need to specify the interfaces provided by the probe - simply specify the implementation ID when registering cmd handlers and publishing vars.
"""

def __init__(self, session: RuntimeSession, module_id="probe"):
def __init__(self, session: RuntimeSession, module_id="probe", start=True):
"""
Construct a probe module and connect it to EVerest.
- session: runtime session information (path to EVerest installation and location of run config file)
Expand All @@ -24,10 +24,17 @@ def __init__(self, session: RuntimeSession, module_id="probe"):
self._setup = m.say_hello()
self._mod = m
self._ready_event = asyncio.Event()
self._started = False

# subscribe to session events
m.init_done(self._ready)
logging.info("Probe module initialized")
if start:
self.start()

def start(self):
if not self._started:
self._started = True
# subscribe to session events
self._mod.init_done(self._ready)
logging.info("Probe module initialized")

async def call_command(self, connection_id: str, command_name: str, args: dict) -> Any:
"""
Expand Down

0 comments on commit 7585b3e

Please sign in to comment.