[py-svn] r23707 - in py/dist/py/path/local: . testing

briandorsey at codespeak.net briandorsey at codespeak.net
Mon Feb 27 22:01:29 CET 2006


Author: briandorsey
Date: Mon Feb 27 22:01:18 2006
New Revision: 23707

Modified:
   py/dist/py/path/local/local.py
   py/dist/py/path/local/testing/test_local.py
Log:
Make py.path.local.remove() more agressive - it now runs chmod(0700) when deleting recursively.


Modified: py/dist/py/path/local/local.py
==============================================================================
--- py/dist/py/path/local/local.py	(original)
+++ py/dist/py/path/local/local.py	Mon Feb 27 22:01:18 2006
@@ -209,6 +209,7 @@
         """ remove a file or directory (or a directory tree if rec=1).  """
         if self.check(dir=1, link=0):
             if rec:
+                self.chmod(0700, rec=True)
                 self._callex(py.std.shutil.rmtree, self.strpath)
             else:
                 self._callex(os.rmdir, self.strpath)

Modified: py/dist/py/path/local/testing/test_local.py
==============================================================================
--- py/dist/py/path/local/testing/test_local.py	(original)
+++ py/dist/py/path/local/testing/test_local.py	Mon Feb 27 22:01:18 2006
@@ -129,6 +129,20 @@
         assert t == newfile
         assert newfile.check(dir=1)
 
+    def test_remove_readonly(self):
+        tmpdir = self.tmpdir / 'subdir'
+        tmpdir.mkdir()
+        tmpfile = tmpdir / 'a_file'
+        f = open(str(tmpfile), 'w')
+        f.close()
+        tmpfile.chmod(0)
+
+        local = py.path.local(tmpdir)
+        local.remove(rec = True)
+
+
+
+
 class TestExecutionOnWindows(LocalSetup):
     disabled = py.std.sys.platform != 'win32'
 



More information about the pytest-commit mailing list