Skip to content

Commit

Permalink
Fixed unit test to work both as a script and as a module.
Browse files Browse the repository at this point in the history
I only ran it as a script.
  • Loading branch information
Jim Fulton committed Apr 24, 2002
1 parent 0100d9d commit 69b8ed5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/testExternalMethod.py
Expand Up @@ -14,7 +14,7 @@
"""
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
Expand All @@ -23,19 +23,20 @@
import Products.ExternalMethod.tests
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')
Expand Down

0 comments on commit 69b8ed5

Please sign in to comment.