diff options
-rw-r--r-- | utils/trackertestutils/dbusdaemon.py | 15 | ||||
-rw-r--r-- | utils/trackertestutils/helpers.py | 6 |
2 files changed, 17 insertions, 4 deletions
diff --git a/utils/trackertestutils/dbusdaemon.py b/utils/trackertestutils/dbusdaemon.py index abd8c6b02..59de04ecf 100644 --- a/utils/trackertestutils/dbusdaemon.py +++ b/utils/trackertestutils/dbusdaemon.py @@ -54,7 +54,17 @@ class DBusDaemon: raise DaemonNotStartedError() return self.address + def create_connection(self): + """Creates a new GDBusConnection.""" + if self.address is None: + raise DaemonNotStartedError() + return Gio.DBusConnection.new_for_address_sync( + self.address, + Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT | + Gio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION, None, None) + def get_connection(self): + """Returns a shared GDBusConnection for general use.""" if self._gdbus_connection is None: raise DaemonNotStartedError() return self._gdbus_connection @@ -98,10 +108,7 @@ class DBusDaemon: self._threads[0].start() self._threads[1].start() - self._gdbus_connection = Gio.DBusConnection.new_for_address_sync( - self.address, - Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT | - Gio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION, None, None) + self._gdbus_connection = self.create_connection() log.debug("Pinging the new D-Bus daemon...") self.ping_sync() diff --git a/utils/trackertestutils/helpers.py b/utils/trackertestutils/helpers.py index 79c19ee6a..db24b4b9a 100644 --- a/utils/trackertestutils/helpers.py +++ b/utils/trackertestutils/helpers.py @@ -497,5 +497,11 @@ class TrackerDBusSandbox: log.info("Stopping D-Bus daemon for sandbox.") self.daemon.stop() + def stop_miner_fs(self): + log.info("Stopping tracker-miner-fs process.") + pid = self.daemon.get_connection_unix_process_id_sync('org.freedesktop.Tracker1.Miner.Files') + os.kill(pid, signal.SIGTERM) + psutil.wait_pid(pid) + def get_connection(self): return self.daemon.get_connection() |