Show More
@@ -586,6 +586,17 b' def rename(src, dst):' | |||
|
586 | 586 | shutil.copy(src, dst) |
|
587 | 587 | os.remove(src) |
|
588 | 588 | |
|
589 | def makecleanable(path): | |
|
590 | """Try to fix directory permission recursively so that the entire tree | |
|
591 | can be deleted""" | |
|
592 | for dirpath, dirnames, _filenames in os.walk(path, topdown=True): | |
|
593 | for d in dirnames: | |
|
594 | p = os.path.join(dirpath, d) | |
|
595 | try: | |
|
596 | os.chmod(p, os.stat(p).st_mode & 0o777 | 0o700) # chmod u+rwx | |
|
597 | except OSError: | |
|
598 | pass | |
|
599 | ||
|
589 | 600 | _unified_diff = difflib.unified_diff |
|
590 | 601 | if PYTHON3: |
|
591 | 602 | import functools |
@@ -952,7 +963,13 b' class Test(unittest.TestCase):' | |||
|
952 | 963 | (self._testtmp.decode('utf-8'), |
|
953 | 964 | self._threadtmp.decode('utf-8'))) |
|
954 | 965 | else: |
|
955 | shutil.rmtree(self._testtmp, True) | |
|
966 | try: | |
|
967 | shutil.rmtree(self._testtmp) | |
|
968 | except OSError: | |
|
969 | # unreadable directory may be left in $TESTTMP; fix permission | |
|
970 | # and try again | |
|
971 | makecleanable(self._testtmp) | |
|
972 | shutil.rmtree(self._testtmp, True) | |
|
956 | 973 | shutil.rmtree(self._threadtmp, True) |
|
957 | 974 | |
|
958 | 975 | if self._usechg: |
General Comments 0
You need to be logged in to leave comments.
Login now