[svn r63102] add a "samefile" method to local path objects.
--HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									a94359c791
								
							
						
					
					
						commit
						f7a23716b5
					
				|  | @ -201,6 +201,10 @@ 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) | ||||||
|  |  | ||||||
|  | @ -14,6 +14,11 @@ 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) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue