[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/Testing/makerequest.py **Don't** pollute os.environ when running tests.

Tres Seaver tseaver at palladion.com
Tue May 16 09:47:31 EDT 2006


Log message for revision 68149:
  **Don't** pollute os.environ when running tests.

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/Testing/makerequest.py

-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/Testing/makerequest.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Testing/makerequest.py	2006-05-16 12:25:25 UTC (rev 68148)
+++ Zope/branches/Zope-2_8-branch/lib/python/Testing/makerequest.py	2006-05-16 13:47:31 UTC (rev 68149)
@@ -24,16 +24,17 @@
 """
 
 import os
-from os import environ
 from sys import stdin, stdout
 from ZPublisher.HTTPRequest import HTTPRequest
 from ZPublisher.HTTPResponse import HTTPResponse
 from ZPublisher.BaseRequest import RequestContainer
 
-def makerequest(app, stdout=stdout):
+def makerequest(app, stdout=stdout, **kw):
     resp = HTTPResponse(stdout=stdout)
-    environ['SERVER_NAME']='foo'
-    environ['SERVER_PORT']='80'
-    environ['REQUEST_METHOD'] = 'GET'
-    req = HTTPRequest(stdin, environ, resp)
+    env = os.environ.copy()
+    env['SERVER_NAME']='foo'
+    env['SERVER_PORT']='80'
+    env['REQUEST_METHOD'] = 'GET'
+    env.update(kw)
+    req = HTTPRequest(stdin, env, resp)
     return app.__of__(RequestContainer(REQUEST = req))



More information about the Zope-Checkins mailing list