18 from .compat
import py2to3
19 from .normalizing
import NormalizedDict
20 from .robottypes
import is_string
37 def __init__(self, no_current_msg='No open connection.'):
44 current_index = property
49 for index, conn
in enumerate(self):
57 if index
is not None else self.
_no_current_no_current
70 self.
currentcurrent = connection
101 if alias_or_index
is None:
103 self.
currentcurrent.raise_error()
107 except ValueError
as err:
108 raise RuntimeError(err.args[0])
111 __getitem__ = get_connection
121 getattr(conn, closer_method)()
146 return resolver(alias_or_index)
149 raise ValueError(
"Non-existing index or alias '%s'." % alias_or_index)
154 warnings.warn(
"'ConnectionCache._resolve_alias_or_index' is "
155 "deprecated. Use 'resolve_alias_or_index' instead.",
181 if name.startswith(
'__')
and name.endswith(
'__'):
186 raise RuntimeError(self.
messagemessage)
Cache for test libs to use with concurrent connections, processes, etc.
def close_all(self, closer_method='close')
Closes connections using given closer method and empties cache.
def _resolve_alias(self, alias)
def _resolve_index(self, index)
def switch(self, alias_or_index)
Switches to the connection specified by the given alias or index.
def register(self, connection, alias=None)
Registers given connection with optional alias and returns its index.
def empty_cache(self)
Empties the connection cache.
def _resolve_alias_or_index(self, alias_or_index)
def __init__(self, no_current_msg='No open connection.')
def get_connection(self, alias_or_index=None)
Get the connection specified by the given alias or index.
def resolve_alias_or_index(self, alias_or_index)
def __getattr__(self, name)
def __init__(self, message)
Custom dictionary implementation automatically normalizing keys.