[svn r37947] added _gethomedir() helper to get at homedirectory

--HG--
branch : trunk
This commit is contained in:
hpk 2007-02-05 01:35:40 +01:00
parent 0b9b0909bf
commit bdf3e919c9
2 changed files with 13 additions and 0 deletions

View File

@ -537,6 +537,15 @@ class LocalPath(common.FSPathBase, PlatformMixin):
pass
return None
sysfind = classmethod(sysfind)
def _gethomedir(cls):
try:
x = os.environ['HOME']
except KeyError:
x = os.environ['HOMEPATH']
return cls(x)
_gethomedir = classmethod(_gethomedir)
#"""
#special class constructors for local filesystem paths
#"""

View File

@ -332,6 +332,10 @@ def test_pypkgdir():
assert pkg.pypkgpath() == pkg
assert pkg.join('subdir', '__init__.py').pypkgpath() == pkg
def test_homedir():
homedir = py.path.local._gethomedir()
assert homedir.check(dir=1)
#class XTestLocalPath(TestLocalPath):
# def __init__(self):
# TestLocalPath.__init__(self)