[svn r37947] added _gethomedir() helper to get at homedirectory
--HG-- branch : trunk
This commit is contained in:
parent
0b9b0909bf
commit
bdf3e919c9
|
@ -537,6 +537,15 @@ class LocalPath(common.FSPathBase, PlatformMixin):
|
||||||
pass
|
pass
|
||||||
return None
|
return None
|
||||||
sysfind = classmethod(sysfind)
|
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
|
#special class constructors for local filesystem paths
|
||||||
#"""
|
#"""
|
||||||
|
|
|
@ -332,6 +332,10 @@ def test_pypkgdir():
|
||||||
assert pkg.pypkgpath() == pkg
|
assert pkg.pypkgpath() == pkg
|
||||||
assert pkg.join('subdir', '__init__.py').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):
|
#class XTestLocalPath(TestLocalPath):
|
||||||
# def __init__(self):
|
# def __init__(self):
|
||||||
# TestLocalPath.__init__(self)
|
# TestLocalPath.__init__(self)
|
||||||
|
|
Loading…
Reference in New Issue