[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/testing.py environ.pop is not equivalent to a get followed by a del. :(

Jim Fulton jim at zope.com
Tue Sep 5 18:55:52 EDT 2006


Log message for revision 69989:
  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.
  

Changed:
  U   zc.buildout/trunk/src/zc/buildout/testing.py

-=-
Modified: zc.buildout/trunk/src/zc/buildout/testing.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/testing.py	2006-09-05 22:55:49 UTC (rev 69988)
+++ zc.buildout/trunk/src/zc/buildout/testing.py	2006-09-05 22:55:52 UTC (rev 69989)
@@ -67,7 +67,8 @@
 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 @@
         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 @@
         )
 
     # 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(),



More information about the Checkins mailing list