Fix tests of read-only repos for non-root users

This commit is contained in:
finefoot 2020-04-13 18:41:41 +02:00 committed by GitHub
parent 0a47e3e160
commit 842cfc8cdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

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