[py-svn] r6888 - in py/dist/py/path: local svn svnwc test
hpk at codespeak.net
hpk at codespeak.net
Sun Oct 10 16:01:43 CEST 2004
Author: hpk
Date: Sun Oct 10 16:01:42 2004
New Revision: 6888
Modified:
py/dist/py/path/local/local.py
py/dist/py/path/svn/common.py
py/dist/py/path/svnwc/command.py
py/dist/py/path/test/_common.py
Log:
allow dirpath() to receive arguments where
x.dirpath(*args) == x.dirpath().join(*args)
holds true.
Modified: py/dist/py/path/local/local.py
==============================================================================
--- py/dist/py/path/local/local.py (original)
+++ py/dist/py/path/local/local.py Sun Oct 10 16:01:42 2004
@@ -189,8 +189,12 @@
def __eq__(self, other):
return str(self) == str(other)
- def dirpath(self):
- return self.new(basename='')
+ def dirpath(self, *args):
+ x = self.new(basename='')
+ if args:
+ return x.join(*args)
+ else:
+ return x
def open(self, mode='r'):
""" return an opened file with the given mode. """
Modified: py/dist/py/path/svn/common.py
==============================================================================
--- py/dist/py/path/svn/common.py (original)
+++ py/dist/py/path/svn/common.py Sun Oct 10 16:01:42 2004
@@ -149,9 +149,9 @@
newpath = self.__class__(self.sep.join(parts), self._rev)
return newpath
- def dirpath(self):
+ def dirpath(self, *args):
""" return the directory Path of the current Path. """
- return self.new(basename='')
+ return self.new(basename='').join(*args)
def propget(self, name):
""" return the content of the given property. """
Modified: py/dist/py/path/svnwc/command.py
==============================================================================
--- py/dist/py/path/svnwc/command.py (original)
+++ py/dist/py/path/svnwc/command.py Sun Oct 10 16:01:42 2004
@@ -90,9 +90,9 @@
""" write content into local filesystem wc. """
self.localpath.write(content)
- def dirpath(self):
+ def dirpath(self, *args):
""" return the directory Path of the current Path. """
- return self.__class__(self.localpath.dirpath())
+ return self.__class__(self.localpath.dirpath(*args))
def _ensuredirs(self):
parent = self.dirpath()
Modified: py/dist/py/path/test/_common.py
==============================================================================
--- py/dist/py/path/test/_common.py (original)
+++ py/dist/py/path/test/_common.py Sun Oct 10 16:01:42 2004
@@ -70,6 +70,10 @@
newpath = self.root.join('sampledir')
assert newpath.dirpath() == self.root
+ def test_dirpath_with_args(self):
+ newpath = self.root.join('sampledir')
+ assert newpath.dirpath('x') == self.root.join('x')
+
def test_purebasename(self):
newpath = self.root.join('samplefile.py')
assert newpath.purebasename == 'samplefile'
More information about the pytest-commit
mailing list