[svn r63103] samefile is only available on posix
--HG-- branch : trunk
This commit is contained in:
parent
f7a23716b5
commit
877a7a32d8
|
@ -201,10 +201,6 @@ class LocalPath(common.FSPathBase, PlatformMixin):
|
||||||
s2 = s2.lower()
|
s2 = s2.lower()
|
||||||
return s1 == s2
|
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'):
|
def open(self, mode='r'):
|
||||||
""" return an opened file with the given mode. """
|
""" return an opened file with the given mode. """
|
||||||
return self._callex(open, self.strpath, mode)
|
return self._callex(open, self.strpath, mode)
|
||||||
|
|
|
@ -110,6 +110,9 @@ class PosixMixin(object):
|
||||||
else:
|
else:
|
||||||
self._callex(os.remove, self.strpath)
|
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):
|
def getuserid(user):
|
||||||
import pwd
|
import pwd
|
||||||
|
|
|
@ -14,11 +14,6 @@ class LocalSetup:
|
||||||
|
|
||||||
class TestLocalPath(LocalSetup, CommonFSTests):
|
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):
|
def test_join_normpath(self):
|
||||||
assert self.tmpdir.join(".") == self.tmpdir
|
assert self.tmpdir.join(".") == self.tmpdir
|
||||||
p = self.tmpdir.join("../%s" % self.tmpdir.basename)
|
p = self.tmpdir.join("../%s" % self.tmpdir.basename)
|
||||||
|
|
|
@ -10,6 +10,11 @@ class TestPOSIXLocalPath:
|
||||||
name = method.im_func.func_name
|
name = method.im_func.func_name
|
||||||
self.tmpdir = self.root.ensure(name, dir=1)
|
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):
|
def test_hardlink(self):
|
||||||
tmpdir = self.tmpdir
|
tmpdir = self.tmpdir
|
||||||
linkpath = tmpdir.join('test')
|
linkpath = tmpdir.join('test')
|
||||||
|
|
Loading…
Reference in New Issue