Commit 8090f07a authored by Jim Fulton's avatar Jim Fulton

environ.pop is not equivalent to a get followed by a del. :(

Added an environment variable hack to cause the buildout to use a
local empty index when running tests. This allows most of the tests to
be run when offline and doesn't slam pypi at other times.
parent cca3b763
......@@ -67,7 +67,8 @@ def get(url):
def buildoutSetUp(test):
# we both need to make sure that HOME isn't set and be prepared
# to restore whatever it was after the test.
test.globs['_oldhome'] = os.environ.pop('HOME', None)
test.globs['_oldhome'] = os.environ['HOME']
del os.environ['HOME'] # pop doesn't truly remove it :(
temporary_directories = []
def mkdtemp(*args):
......@@ -75,6 +76,8 @@ def buildoutSetUp(test):
temporary_directories.append(d)
return d
os.environ['buildout-testing-index-url'] = 'file://'+mkdtemp()
sample = mkdtemp('sample-buildout')
# Create a basic buildout.cfg to avoid a warning from buildout:
......@@ -83,8 +86,10 @@ def buildoutSetUp(test):
)
# Use the buildout bootstrap command to create a buildout
zc.buildout.buildout.Buildout(os.path.join(sample, 'buildout.cfg'), ()
).bootstrap([])
zc.buildout.buildout.Buildout(
os.path.join(sample, 'buildout.cfg'),
[('buildout', 'log-level', 'WARNING')]
).bootstrap([])
test.globs.update(dict(
__here = os.getcwd(),
......
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