Commit fb7cb086 authored by jim's avatar jim

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.


git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@69989 62d5b8a3-27da-0310-9561-8e5933582275
parent ae77905a
...@@ -67,7 +67,8 @@ def get(url): ...@@ -67,7 +67,8 @@ def get(url):
def buildoutSetUp(test): def buildoutSetUp(test):
# we both need to make sure that HOME isn't set and be prepared # we both need to make sure that HOME isn't set and be prepared
# to restore whatever it was after the test. # 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 = [] temporary_directories = []
def mkdtemp(*args): def mkdtemp(*args):
...@@ -75,6 +76,8 @@ def buildoutSetUp(test): ...@@ -75,6 +76,8 @@ def buildoutSetUp(test):
temporary_directories.append(d) temporary_directories.append(d)
return d return d
os.environ['buildout-testing-index-url'] = 'file://'+mkdtemp()
sample = mkdtemp('sample-buildout') sample = mkdtemp('sample-buildout')
# Create a basic buildout.cfg to avoid a warning from buildout: # Create a basic buildout.cfg to avoid a warning from buildout:
...@@ -83,7 +86,9 @@ def buildoutSetUp(test): ...@@ -83,7 +86,9 @@ def buildoutSetUp(test):
) )
# Use the buildout bootstrap command to create a buildout # Use the buildout bootstrap command to create a buildout
zc.buildout.buildout.Buildout(os.path.join(sample, 'buildout.cfg'), () zc.buildout.buildout.Buildout(
os.path.join(sample, 'buildout.cfg'),
[('buildout', 'log-level', 'WARNING')]
).bootstrap([]) ).bootstrap([])
test.globs.update(dict( test.globs.update(dict(
......
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