Commit 7ff831c3 authored by jim's avatar jim

Changed the way the test setup avoids reading ~/.buildout/default.cfg

to work with recent change changes to use expanduser rather than
reading $HOME directly.


git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@79038 62d5b8a3-27da-0310-9561-8e5933582275
parent b2716a93
......@@ -1127,6 +1127,7 @@ reading the configuration file. ($HOME is the value of the HOME
environment variable. The '/' is replaced by the operating system file
delimiter.)
>>> old_home = os.environ['HOME']
>>> home = tmpdir('home')
>>> mkdir(home, '.buildout')
>>> write(home, '.buildout', 'default.cfg',
......@@ -1167,7 +1168,7 @@ user defaults:
op5 b3base 5
recipe recipes:debug
>>> del os.environ['HOME']
>>> os.environ['HOME'] = old_home
Log level
---------
......
......@@ -156,13 +156,19 @@ def buildoutSetUp(test):
here = os.getcwd()
register_teardown(lambda: os.chdir(here))
old_home = os.environ.get('HOME')
if old_home is not None:
del os.environ['HOME'] # pop doesn't truly remove it :(
register_teardown(lambda: os.environ.__setitem__('HOME', old_home))
base = tempfile.mkdtemp('buildoutSetUp')
register_teardown(lambda base=base: shutil.rmtree(base))
old_home = os.environ.get('HOME')
os.environ['HOME'] = os.path.join(base, 'bbbBadHome')
def restore_home():
if old_home is None:
del os.environ['HOME']
else:
os.environ['HOME'] = old_home
register_teardown(restore_home)
base = os.path.join(base, '_TEST_')
os.mkdir(base)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment