[py-svn] r63103 - in py/trunk/py/path/local: . testing

hpk at codespeak.net hpk at codespeak.net
Fri Mar 20 01:30:35 CET 2009


Author: hpk
Date: Fri Mar 20 01:30:32 2009
New Revision: 63103

Modified:
   py/trunk/py/path/local/local.py
   py/trunk/py/path/local/posix.py
   py/trunk/py/path/local/testing/test_local.py
   py/trunk/py/path/local/testing/test_posix.py
Log:
samefile is only available on posix


Modified: py/trunk/py/path/local/local.py
==============================================================================
--- py/trunk/py/path/local/local.py	(original)
+++ py/trunk/py/path/local/local.py	Fri Mar 20 01:30:32 2009
@@ -201,10 +201,6 @@
             s2 = s2.lower()
         return s1 == s2
 
-    def samefile(self, other):
-        """ return True if other refers to the same stat object as self. """
-        return py.std.os.path.samefile(str(self), str(other))
-
     def open(self, mode='r'):
         """ return an opened file with the given mode. """
         return self._callex(open, self.strpath, mode)

Modified: py/trunk/py/path/local/posix.py
==============================================================================
--- py/trunk/py/path/local/posix.py	(original)
+++ py/trunk/py/path/local/posix.py	Fri Mar 20 01:30:32 2009
@@ -110,6 +110,9 @@
         else:
             self._callex(os.remove, self.strpath)
 
+    def samefile(self, other):
+        """ return True if other refers to the same stat object as self. """
+        return py.std.os.path.samefile(str(self), str(other))
 
 def getuserid(user):
     import pwd

Modified: py/trunk/py/path/local/testing/test_local.py
==============================================================================
--- py/trunk/py/path/local/testing/test_local.py	(original)
+++ py/trunk/py/path/local/testing/test_local.py	Fri Mar 20 01:30:32 2009
@@ -14,11 +14,6 @@
 
 class TestLocalPath(LocalSetup, CommonFSTests):
 
-    def test_samefile(self):
-        assert self.tmpdir.samefile(self.tmpdir)
-        p = self.tmpdir.ensure("hello")
-        assert p.samefile(p) 
-
     def test_join_normpath(self):
         assert self.tmpdir.join(".") == self.tmpdir
         p = self.tmpdir.join("../%s" % self.tmpdir.basename)

Modified: py/trunk/py/path/local/testing/test_posix.py
==============================================================================
--- py/trunk/py/path/local/testing/test_posix.py	(original)
+++ py/trunk/py/path/local/testing/test_posix.py	Fri Mar 20 01:30:32 2009
@@ -10,6 +10,11 @@
         name = method.im_func.func_name
         self.tmpdir = self.root.ensure(name, dir=1) 
 
+    def test_samefile(self):
+        assert self.tmpdir.samefile(self.tmpdir)
+        p = self.tmpdir.ensure("hello")
+        assert p.samefile(p) 
+
     def test_hardlink(self):
         tmpdir = self.tmpdir 
         linkpath = tmpdir.join('test')



More information about the pytest-commit mailing list