From 877a7a32d8ec10fe5e1aa9de5810a19093307d03 Mon Sep 17 00:00:00 2001 From: hpk Date: Fri, 20 Mar 2009 01:30:32 +0100 Subject: [PATCH] [svn r63103] samefile is only available on posix --HG-- branch : trunk --- py/path/local/local.py | 4 ---- py/path/local/posix.py | 3 +++ py/path/local/testing/test_local.py | 5 ----- py/path/local/testing/test_posix.py | 5 +++++ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/py/path/local/local.py b/py/path/local/local.py index dc5230cd0..57f2e2cdb 100644 --- a/py/path/local/local.py +++ b/py/path/local/local.py @@ -201,10 +201,6 @@ class LocalPath(common.FSPathBase, PlatformMixin): 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) diff --git a/py/path/local/posix.py b/py/path/local/posix.py index 62a5f8cf9..86817658a 100644 --- a/py/path/local/posix.py +++ b/py/path/local/posix.py @@ -110,6 +110,9 @@ class PosixMixin(object): 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 diff --git a/py/path/local/testing/test_local.py b/py/path/local/testing/test_local.py index fe697134f..99cc733e3 100644 --- a/py/path/local/testing/test_local.py +++ b/py/path/local/testing/test_local.py @@ -14,11 +14,6 @@ class LocalSetup: 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) diff --git a/py/path/local/testing/test_posix.py b/py/path/local/testing/test_posix.py index ee2fe4129..d393fb98b 100644 --- a/py/path/local/testing/test_posix.py +++ b/py/path/local/testing/test_posix.py @@ -10,6 +10,11 @@ class TestPOSIXLocalPath: 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')