summaryrefslogtreecommitdiff
path: root/virtManager/config.py
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2020-08-21 13:34:10 -0400
committerCole Robinson <crobinso@redhat.com>2020-08-26 15:20:05 -0400
commit8dd3b8ba200cab5955b333e8bced3d40671f7815 (patch)
treee4070bf8d4e1d718c095da00cd62419257f136e0 /virtManager/config.py
parenta121c943ef29b30c2c9cf49a79cb359c9c3cb68f (diff)
downloadvirt-manager-8dd3b8ba200cab5955b333e8bced3d40671f7815.tar.gz
virt-manager: Add --test-options gsettings-keyfile
This will let us test some difficult code paths in the uitests. Rework the `--test-options first-run` behavior to use a temporary keyfile rather than the memory backend, to unify the code paths Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'virtManager/config.py')
-rw-r--r--virtManager/config.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/virtManager/config.py b/virtManager/config.py
index d340f767..0e6f2d60 100644
--- a/virtManager/config.py
+++ b/virtManager/config.py
@@ -47,16 +47,23 @@ class _SettingsWrapper(object):
we internally convert it to the settings nested hierarchy. Makes
client code much smaller.
"""
- def __init__(self, settings_id):
+ def __init__(self, settings_id, gsettings_keyfile):
self._root = settings_id
- self._settings = Gio.Settings.new(self._root)
+
+ if gsettings_keyfile:
+ backend = Gio.keyfile_settings_backend_new(gsettings_keyfile, "/")
+ else:
+ backend = Gio.SettingsBackend.get_default()
+
+ self._settings = Gio.Settings.new_with_backend(self._root, backend)
self._settingsmap = {"": self._settings}
self._handler_map = {}
for child in self._settings.list_children():
childschema = self._root + "." + child
- self._settingsmap[child] = Gio.Settings.new(childschema)
+ self._settingsmap[child] = Gio.Settings.new_with_backend(
+ childschema, backend)
###################
@@ -189,7 +196,8 @@ class vmmConfig(object):
self.conf_dir = "/org/virt-manager/%s/" % self.appname
self.ui_dir = BuildConfig.ui_dir
- self.conf = _SettingsWrapper("org.virt-manager.virt-manager")
+ self.conf = _SettingsWrapper("org.virt-manager.virt-manager",
+ CLITestOptions.gsettings_keyfile)
self.CLITestOptions = CLITestOptions
if self.CLITestOptions.xmleditor_enabled: