Commit 47d61f5b authored by Jim Fulton's avatar Jim Fulton

Fixed unit test to work both as a script and as a module.

I only ran it as a script.
parent 51a8e2cc
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
""" """
Revision information: Revision information:
$Id: testExternalMethod.py,v 1.3 2002/04/23 13:04:20 jim Exp $ $Id: testExternalMethod.py,v 1.4 2002/04/24 00:20:15 jim Exp $
""" """
import math, os import math, os
...@@ -23,19 +23,20 @@ import ZODB # dead goat ...@@ -23,19 +23,20 @@ import ZODB # dead goat
import Products.ExternalMethod.tests import Products.ExternalMethod.tests
from Products.ExternalMethod.ExternalMethod import ExternalMethod from Products.ExternalMethod.ExternalMethod import ExternalMethod
builtinsdict = getattr(__builtins__, '__dict__', __builtins__)
class Test(TestCase): class Test(TestCase):
def setUp(self): def setUp(self):
self._old = __builtins__.__dict__.get('INSTANCE_HOME') self._old = builtinsdict.get('INSTANCE_HOME')
__builtins__.INSTANCE_HOME = os.path.split( builtinsdict['INSTANCE_HOME'] = os.path.split(
Products.ExternalMethod.tests.__file__)[0] Products.ExternalMethod.tests.__file__)[0]
def tearDown(self): def tearDown(self):
if self._old is None: if self._old is None:
del __builtins__.INSTANCE_HOME del builtinsdict['INSTANCE_HOME']
else: else:
__builtins__.INSTANCE_HOME = self._old builtinsdict['INSTANCE_HOME'] = self._old
def testStorage(self): def testStorage(self):
em1 = ExternalMethod('em', 'test method', 'Test', 'testf') em1 = ExternalMethod('em', 'test method', 'Test', 'testf')
......
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