96 def _restart_lomiri_with_testability(self):
97 _environment = {}
98
99 data_dirs = get_data_dirs(True)
100 if data_dirs is not None:
101 _environment['XDG_DATA_DIRS'] = data_dirs
102
103 _environment['QML2_IMPORT_PATH'] = (
104 self._get_qml_import_path_with_mock()
105 )
106
107 new_ld_library_path = [
108 get_default_extra_mock_libraries(),
109 self._get_lightdm_mock_path()
110 ]
111 if os.getenv('LD_LIBRARY_PATH') is not None:
112 new_ld_library_path.append(os.getenv('LD_LIBRARY_PATH'))
113 new_ld_library_path = ':'.join(new_ld_library_path)
114 _environment['LD_LIBRARY_PATH'] = new_ld_library_path
115
116
117
118
119 try:
120 os.unlink(
121 os.getenv('MIR_SOCKET',
122 os.path.join(os.getenv('XDG_RUNTIME_DIR', "/tmp"),
123 "mir_socket")))
124 except OSError:
125 pass
126 try:
127 os.unlink("/tmp/mir_socket")
128 except OSError:
129 pass
130
131 binary_arg = "BINARY=%s" % get_binary_path()
132 env_args = ["%s=%s" % (k, v) for k, v in _environment.items()]
133 args = [binary_arg] + env_args
134 self.lomiri_proxy = process_helpers.restart_lomiri_with_testability(
135 *args)
136 self.main_win = self.lomiri_proxy.select_single(shell.ShellView)
137