[Zope-Checkins] CVS: Zope/lib/python/Products/ExternalMethod/tests - testExternalMethod.py:1.4

Jim Fulton jim@zope.com
Tue, 23 Apr 2002 20:20:15 -0400


Update of /cvs-repository/Zope/lib/python/Products/ExternalMethod/tests
In directory cvs.zope.org:/tmp/cvs-serv30274

Modified Files:
	testExternalMethod.py 
Log Message:
Fixed unit test to work both as a script and as a module. 
I only ran it as a script.


=== Zope/lib/python/Products/ExternalMethod/tests/testExternalMethod.py 1.3 => 1.4 ===
 from Products.ExternalMethod.ExternalMethod import ExternalMethod
 
+builtinsdict = getattr(__builtins__, '__dict__', __builtins__)
 
 class Test(TestCase):
 
     def setUp(self):
-        self._old = __builtins__.__dict__.get('INSTANCE_HOME')
-        __builtins__.INSTANCE_HOME = os.path.split(
+        self._old = builtinsdict.get('INSTANCE_HOME')
+        builtinsdict['INSTANCE_HOME'] = os.path.split(
             Products.ExternalMethod.tests.__file__)[0]
 
     def tearDown(self):
         if self._old is None:
-            del __builtins__.INSTANCE_HOME
+            del builtinsdict['INSTANCE_HOME']
         else:
-            __builtins__.INSTANCE_HOME = self._old
+            builtinsdict['INSTANCE_HOME'] = self._old
 
     def testStorage(self):
         em1 = ExternalMethod('em', 'test method', 'Test', 'testf')