]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-135386: Skip readonly tests for the root user (GH-138058)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 22 Aug 2025 13:22:14 +0000 (16:22 +0300)
committerGitHub <noreply@github.com>
Fri, 22 Aug 2025 13:22:14 +0000 (16:22 +0300)
Lib/test/test_dbm_sqlite3.py

index 15826f51c54180329e8e7fd23678925aab57d47d..f367a98865d4aadd0826b144b52a3c8a291b9829 100644 (file)
@@ -16,6 +16,11 @@ import sqlite3
 from dbm.sqlite3 import _normalize_uri
 
 
+root_in_posix = False
+if hasattr(os, 'geteuid'):
+    root_in_posix = (os.geteuid() == 0)
+
+
 class _SQLiteDbmTests(unittest.TestCase):
 
     def setUp(self):
@@ -92,6 +97,7 @@ class ReadOnly(_SQLiteDbmTests):
         self.assertEqual([k for k in self.db], [b"key1", b"key2"])
 
 
+@unittest.skipIf(root_in_posix, "test is meanless with root privilege")
 class ReadOnlyFilesystem(unittest.TestCase):
 
     def setUp(self):