Skip to content

Commit 8981002

Browse files
committed
Fix make_dir_writable
1 parent 2d1a04c commit 8981002

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

test/common.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -679,27 +679,16 @@ def make_executable(name):
679679

680680

681681
def make_dir_writeable(dirname):
682-
# Ensure all files are readable and writable by the current user.
683-
permission_bits = stat.S_IWRITE | stat.S_IREAD
684-
685-
def is_writable(path):
686-
return (os.stat(path).st_mode & permission_bits) != permission_bits
687-
688-
def make_writable(path):
689-
new_mode = os.stat(path).st_mode | permission_bits
690-
os.chmod(path, new_mode)
691-
692682
# Some tests make files and subdirectories read-only, so rmtree/unlink will not delete
693683
# them. Force-make everything writable in the subdirectory to make it
694684
# removable and re-attempt.
695-
if not is_writable(dirname):
696-
make_writable(dirname)
685+
os.chmod(dirname, 0o777)
697686

698687
for directory, subdirs, files in os.walk(dirname):
699688
for item in files + subdirs:
700689
i = os.path.join(directory, item)
701690
if not os.path.islink(i):
702-
make_writable(i)
691+
os.chmod(i, 0o777)
703692

704693

705694
def force_delete_dir(dirname):

0 commit comments

Comments
 (0)