Pārlūkot izejas kodu

Merge pull request #5113 from finefoot/patch-2

Port of #5112 Fix tests of read-only repos for non-root users
TW 5 gadi atpakaļ
vecāks
revīzija
b7acf0da74
1 mainītis faili ar 2 papildinājumiem un 0 dzēšanām
  1. 2 0
      src/borg/testsuite/__init__.py

+ 2 - 0
src/borg/testsuite/__init__.py

@@ -290,11 +290,13 @@ class BaseTestCase(unittest.TestCase):
             message = 'Testing read-only repos is not supported on platform %s' % sys.platform
             self.skipTest(message)
         try:
+            os.system('chmod -R ugo-w "%s"' % path)
             os.system(cmd_immutable)
             yield
         finally:
             # Restore permissions to ensure clean-up doesn't fail
             os.system(cmd_mutable)
+            os.system('chmod -R ugo+w "%s"' % path)
 
 
 class changedir: