Lomiri
Loading...
Searching...
No Matches
lomiri.fixture_setup.RestartLomiriWithTestability Class Reference

Inherits fixtures.Fixture.

Public Member Functions

 __init__ (self, binary_path, variables)
 
 setUp (self)
 
 restart_lomiri (self)
 
 restart_lomiri_with_testability (self)
 
 stop_lomiri (self)
 

Public Attributes

 binary_path
 
 variables
 
 stop_lomiri
 

Static Public Attributes

 lomiri_proxy = None
 

Protected Member Functions

 _unlink_mir_socket (self)
 

Detailed Description

Fixture to launch Lomiri with testability.

:ivar lomiri_proxy: The Autopilot proxy object for the Lomiri shell.

Definition at line 155 of file fixture_setup.py.

Constructor & Destructor Documentation

◆ __init__()

lomiri.fixture_setup.RestartLomiriWithTestability.__init__ (   self,
  binary_path,
  variables 
)
Initialize the fixture instance.

:param str binary_path: The path to the Dash app binary.
:param cli_arguments: The arguments to pass when launching the
:param variables: The variables to use when launching the app.
:type variables: A dictionary.

Definition at line 165 of file fixture_setup.py.

165 def __init__(self, binary_path, variables):
166 """Initialize the fixture instance.
167
168 :param str binary_path: The path to the Dash app binary.
169 :param cli_arguments: The arguments to pass when launching the
170 :param variables: The variables to use when launching the app.
171 :type variables: A dictionary.
172
173 """
174 super().__init__()
175 self.binary_path = binary_path
176 self.variables = variables
177

Member Function Documentation

◆ _unlink_mir_socket()

lomiri.fixture_setup.RestartLomiriWithTestability._unlink_mir_socket (   self)
protected

Definition at line 199 of file fixture_setup.py.

199 def _unlink_mir_socket(self):
200 # FIXME: we shouldn't be doing this
201 # $MIR_SOCKET, fallback to $XDG_RUNTIME_DIR/mir_socket and
202 # /tmp/mir_socket as last resort
203 try:
204 os.unlink(
205 os.getenv('MIR_SOCKET',
206 os.path.join(os.getenv('XDG_RUNTIME_DIR', "/tmp"),
207 "mir_socket")))
208 except OSError:
209 pass
210 try:
211 os.unlink("/tmp/mir_socket")
212 except OSError:
213 pass
214

◆ restart_lomiri()

lomiri.fixture_setup.RestartLomiriWithTestability.restart_lomiri (   self)

Definition at line 184 of file fixture_setup.py.

184 def restart_lomiri(self):
185 self.restart_lomiri_with_testability()
186

◆ restart_lomiri_with_testability()

lomiri.fixture_setup.RestartLomiriWithTestability.restart_lomiri_with_testability (   self)

Definition at line 187 of file fixture_setup.py.

187 def restart_lomiri_with_testability(self):
188 self._unlink_mir_socket()
189
190 binary_arg = 'BINARY={}'.format(self.binary_path)
191 variable_args = [
192 '{}={}'.format(key, value) for key, value in self.variables.items()
193 ]
194 all_args = [binary_arg] + variable_args
195
196 self.lomiri_proxy = process_helpers.restart_lomiri_with_testability(
197 *all_args)
198

◆ setUp()

lomiri.fixture_setup.RestartLomiriWithTestability.setUp (   self)
Restart lomiri with testability when the fixture is used.

Definition at line 178 of file fixture_setup.py.

178 def setUp(self):
179 """Restart lomiri with testability when the fixture is used."""
180 super().setUp()
181 self.addCleanup(self.stop_lomiri)
182 self.restart_lomiri()
183

◆ stop_lomiri()

lomiri.fixture_setup.RestartLomiriWithTestability.stop_lomiri (   self)

Definition at line 215 of file fixture_setup.py.

215 def stop_lomiri(self):
216 process_helpers.stop_job('lomiri')
217
218

Member Data Documentation

◆ binary_path

lomiri.fixture_setup.RestartLomiriWithTestability.binary_path

Definition at line 175 of file fixture_setup.py.

◆ lomiri_proxy

lomiri.fixture_setup.RestartLomiriWithTestability.lomiri_proxy = None
static

Definition at line 163 of file fixture_setup.py.

◆ stop_lomiri

lomiri.fixture_setup.RestartLomiriWithTestability.stop_lomiri

Definition at line 181 of file fixture_setup.py.

◆ variables

lomiri.fixture_setup.RestartLomiriWithTestability.variables

Definition at line 176 of file fixture_setup.py.


The documentation for this class was generated from the following file: