[py-svn] commit/py: hpk42: fix issue #20 path.samefile(relpath) works

Bitbucket commits-noreply at bitbucket.org
Thu Jan 27 15:13:22 CET 2011


1 new changeset in py:

http://bitbucket.org/hpk42/py/changeset/dac3d52eae84/
changeset:   r2000:dac3d52eae84
user:        hpk42
date:        2011-01-27 15:13:14
summary:     fix issue #20 path.samefile(relpath) works
affected #:  5 files (310 bytes)

--- a/CHANGELOG	Wed Jan 26 22:51:00 2011 +0100
+++ b/CHANGELOG	Thu Jan 27 15:13:14 2011 +0100
@@ -14,6 +14,10 @@
 
 - fix py.error.* attribute pypy access issue
 
+- allow path.samefile(arg) to succeed when arg is a relative filename
+
+- fix (pytest-) issue20 path.samefile(relpath) works as expected now
+
 Changes between 1.3.4 and 1.4.0
 ==================================================
 


--- a/py/__init__.py	Wed Jan 26 22:51:00 2011 +0100
+++ b/py/__init__.py	Thu Jan 27 15:13:14 2011 +0100
@@ -8,7 +8,7 @@
 
 (c) Holger Krekel and others, 2004-2010
 """
-__version__ = '1.4.1.dev3'
+__version__ = '1.4.1.dev4'
 
 from py import _apipkg
 


--- a/py/_path/local.py	Wed Jan 26 22:51:00 2011 +0100
+++ b/py/_path/local.py	Thu Jan 27 15:13:14 2011 +0100
@@ -158,11 +158,12 @@
 
     def samefile(self, other):
         """ return True if 'other' references the same file as 'self'. """
-        if self == other:
-            return True
         if not iswin32:
-            return py.error.checked_call(os.path.samefile, str(self), str(other))
-        return False
+            return py.error.checked_call(
+                    os.path.samefile, str(self), str(other))
+        if not os.path.isabs(other):
+            other = os.path.abspath(other)
+        return self == other
 
     def remove(self, rec=1, ignore_errors=False):
         """ remove a file or directory (or a directory tree if rec=1).


--- a/setup.py	Wed Jan 26 22:51:00 2011 +0100
+++ b/setup.py	Thu Jan 27 15:13:14 2011 +0100
@@ -9,7 +9,7 @@
         name='py',
         description='library with cross-python path, ini-parsing, io, code, log facilities',
         long_description = open('README.txt').read(),
-        version='1.4.1.dev3',
+        version='1.4.1.dev4',
         url='http://pylib.org',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],


--- a/testing/path/test_local.py	Wed Jan 26 22:51:00 2011 +0100
+++ b/testing/path/test_local.py	Thu Jan 27 15:13:14 2011 +0100
@@ -420,6 +420,11 @@
     assert tmpdir.samefile(tmpdir)
     p = tmpdir.ensure("hello")
     assert p.samefile(p)
+    old = p.dirpath().chdir()
+    try:
+        assert p.samefile(p.basename)
+    finally:
+        old.chdir()
     if sys.platform == "win32":
         p1 = p.__class__(str(p).lower())
         p2 = p.__class__(str(p).upper())

Repository URL: https://bitbucket.org/hpk42/py/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the pytest-commit mailing list