[dconf: 2/6] tests: dconf ignores files starting with a dot



commit 66d32800f57a075603dc3e9e40793077a9bbafcf
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Wed Nov 14 00:00:00 2018 +0000

    tests: dconf ignores files starting with a dot

 tests/test-dconf.py | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/tests/test-dconf.py b/tests/test-dconf.py
index e7ff747..64d3337 100755
--- a/tests/test-dconf.py
+++ b/tests/test-dconf.py
@@ -98,6 +98,7 @@ class DBusTest(unittest.TestCase):
         os.mkdir(self.runtime_dir, mode=0o700)
         os.mkdir(self.config_home, mode=0o700)
         os.mkdir(self.dbus_dir, mode=0o700)
+        os.mkdir(os.path.join(self.config_home, 'dconf'))
 
         os.environ['XDG_RUNTIME_DIR'] = self.runtime_dir
         os.environ['XDG_CONFIG_HOME'] = self.config_home
@@ -475,9 +476,6 @@ class DBusTest(unittest.TestCase):
         user_d = os.path.join(self.temporary_dir.name, 'user.d')
         os.mkdir(user_d, mode=0o700)
 
-        # Required from compile utility specifically.
-        os.mkdir(os.path.join(self.config_home, 'dconf'), mode=0o700)
-
         def write_config_d(name):
             keyfile = dedent('''
             [org]
@@ -542,6 +540,34 @@ class DBusTest(unittest.TestCase):
         dconf('reset', '-f', '/non-existing/directory/')
         self.assertEqual(saved_mtime, os.path.getmtime(config))
 
+    def test_compile_dotfiles(self):
+        """Compile ignores files starting with a dot."""
+
+        user_d = os.path.join(self.temporary_dir.name, 'user.d')
+        os.mkdir(user_d)
+
+        a_conf = dedent('''\
+        [math]
+        a=42
+        ''')
+
+        a_conf_swp = dedent('''\
+        [math]
+        b=13
+        ''')
+
+        with open(os.path.join(user_d, 'a.conf'), 'w') as file:
+            file.write(a_conf)
+
+        with open(os.path.join(user_d, '.a.conf.swp'), 'w') as file:
+            file.write(a_conf_swp)
+
+        dconf('compile',
+              os.path.join(self.config_home, 'dconf', 'user'),
+              user_d)
+
+        self.assertEqual(a_conf, dconf('dump', '/').stdout)
+
 
 if __name__ == '__main__':
     # Make sure we don't pick up mandatory profile.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]