[py-svn] pylib commit bd406471f394: fix path.dirname on windows, some detail fixes to make cross linux/windows testing work

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Nov 13 19:46:39 CET 2010


# HG changeset patch -- Bitbucket.org
# Project pylib
# URL http://bitbucket.org/hpk42/pylib/overview
# User holger krekel <holger at merlinux.eu>
# Date 1289673971 -3600
# Node ID bd406471f39498a5f9e99c53315378e83702becd
# Parent  f5b2ad2c9cb0d7e048ff93ddaec8286786148005
fix path.dirname on windows, some detail fixes to make cross linux/windows testing work

--- a/py/_path/local.py
+++ b/py/_path/local.py
@@ -229,24 +229,17 @@ class LocalPath(FSBase):
                     ext = '.' + ext
             kw['basename'] = pb + ext
 
-        kw.setdefault('drive', drive)
-        kw.setdefault('dirname', dirname)
+        if ('dirname' in kw and not kw['dirname']):
+            kw['dirname'] = drive
+        else:
+            kw.setdefault('dirname', dirname)
         kw.setdefault('sep', self.sep)
         obj.strpath = os.path.normpath(
-            "%(drive)s%(dirname)s%(sep)s%(basename)s" % kw)
+            "%(dirname)s%(sep)s%(basename)s" % kw)
         return obj
 
     def _getbyspec(self, spec):
-        """ return a sequence of specified path parts.  'spec' is
-            a comma separated string containing path part names.
-            according to the following convention:
-            a:/some/path/to/a/file.ext
-            ||                            drive
-              |-------------|             dirname
-                              |------|    basename
-                              |--|        purebasename
-                                  |--|    ext
-        """
+        """ see new for what 'spec' can be. """
         res = []
         parts = self.strpath.split(self.sep)
 
@@ -256,7 +249,7 @@ class LocalPath(FSBase):
             if name == 'drive':
                 append(parts[0])
             elif name == 'dirname':
-                append(self.sep.join(['']+parts[1:-1]))
+                append(self.sep.join(parts[:-1]))
             else:
                 basename = parts[-1]
                 if name == 'basename':

--- a/conftest.py
+++ b/conftest.py
@@ -5,7 +5,6 @@ pytest_plugins = 'doctest pytester'.spli
 
 collect_ignore = ['build', 'doc/_build']
 
-rsyncdirs = ['conftest.py', 'py', 'doc', 'testing']
 
 import os, py
 pid = os.getpid()

--- a/tox.ini
+++ b/tox.ini
@@ -20,3 +20,6 @@ commands=
 changedir=testing
 commands=
     {envpython} -m pytest -rfsxX --junitxml={envlogdir}/junit-{envname}0.xml [io_ code]
+
+[pytest]
+rsyncdirs = conftest.py py doc testing

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -10,7 +10,8 @@ Changes between 1.3.4 and 2.0.0dev0
 - use apipkg-1.1 and make py.apipkg.initpkg|ApiModule available
 - add py.iniconfig module for brain-dead easy ini-config file parsing
 - introduce py.builtin.any()
-- path objects have a .dirname attribute now
+- path objects have a .dirname attribute now (equivalent to
+  os.path.dirname(path))
 - path.visit() accepts breadthfirst (bf) and sort options
 
 Changes between 1.3.3 and 1.3.4



More information about the pytest-commit mailing list