[py-svn] pylib commit 45b898021117: introduce a dirname attribute to path objects
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Nov 4 16:02:15 CET 2010
# HG changeset patch -- Bitbucket.org
# Project pylib
# URL http://bitbucket.org/hpk42/pylib/overview
# User holger krekel <holger at merlinux.eu>
# Date 1288728276 -3600
# Node ID 45b89802111778fd14cfb57646dd17a54da282e4
# Parent 95f405382cc8501c1099c339345c5c680e96c22e
introduce a dirname attribute to path objects
--- a/py/_path/common.py
+++ b/py/_path/common.py
@@ -91,6 +91,11 @@ class PathBase(object):
return self._getbyspec('basename')[0]
basename = property(basename, None, None, basename.__doc__)
+ def dirname(self):
+ """ dirname part of path. """
+ return self._getbyspec('dirname')[0]
+ dirname = property(dirname, None, None, dirname.__doc__)
+
def purebasename(self):
""" pure base name of the path."""
return self._getbyspec('purebasename')[0]
--- a/testing/path/common.py
+++ b/testing/path/common.py
@@ -68,6 +68,10 @@ class CommonFSTests(object):
assert newpath.check(basename='sampledir')
assert newpath.basename, 'sampledir'
+ def test_dirname(self, path1):
+ newpath = path1.join('sampledir')
+ assert newpath.dirname == str(path1)
+
def test_dirpath(self, path1):
newpath = path1.join('sampledir')
assert newpath.dirpath() == path1
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -10,6 +10,7 @@ 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
Changes between 1.3.3 and 1.3.4
==================================================
More information about the pytest-commit
mailing list