def check_session_instance(patch_build_session, hardware, loop) -> BaseSession:
    return loop.run_until_complete(
        CheckSession.create(configuration=SessionConfiguration(
            hardware=hardware,
            is_active=lambda x: False,
            protocol_manager=None),
                            instance_meta=SessionMetaData()))
Example #2
0
async def test_create_session_error(hardware, patch_build_session,
                                    build_exception):
    async def raiser(x):
        raise build_exception("Please attach pipettes before proceeding")

    patch_build_session.side_effect = raiser

    with pytest.raises(SessionCreationException):
        await CheckSession.create(configuration=SessionConfiguration(
            hardware=hardware, is_active=lambda x: False),
                                  instance_meta=SessionMetaData())
Example #3
0
    def __init__(self, hardware: ThreadManager,
                 protocol_manager: ProtocolManager):
        """
        Construct the session manager

        :param hardware: ThreadManager to interact with hardware
        :param protocol_manager: ProtocolManager for protocol related sessions
        """
        self._sessions: Dict[IdentifierType, BaseSession] = {}
        self._active = ActiveSessionId(default_id=DefaultSession.DEFAULT_ID)
        # Create object supplied to all sessions
        self._session_common = SessionConfiguration(
            hardware=hardware,
            is_active=self.is_active,
            protocol_manager=protocol_manager)
        # Create the default session.
        asyncio.new_event_loop().run_until_complete(
            self.add(SessionType.default, SessionMetaData()))
Example #4
0
 def __init__(self, hardware: ThreadManager):
     self._sessions: Dict[IdentifierType, BaseSession] = {}
     self._active_session_id: Optional[IdentifierType] = None
     # Create object supplied to all sessions
     self._session_common = SessionConfiguration(hardware=hardware,
                                                 is_active=self.is_active)