Commit 7b10cecd authored by Stefan H. Holek's avatar Stefan H. Holek

Sync changes from CVS.

parent c611580e
...@@ -12,6 +12,7 @@ from zope.testing import doctest ...@@ -12,6 +12,7 @@ from zope.testing import doctest
from Testing.ZopeTestCase import ZopeTestCase from Testing.ZopeTestCase import ZopeTestCase
from Testing.ZopeTestCase import FunctionalTestCase from Testing.ZopeTestCase import FunctionalTestCase
from Testing.ZopeTestCase import Functional from Testing.ZopeTestCase import Functional
from Testing.ZopeTestCase import folder_name
from Testing.ZopeTestCase import user_name from Testing.ZopeTestCase import user_name
from Testing.ZopeTestCase import user_password from Testing.ZopeTestCase import user_password
from Testing.ZopeTestCase import user_role from Testing.ZopeTestCase import user_role
...@@ -182,7 +183,9 @@ class ZopeSuiteFactory: ...@@ -182,7 +183,9 @@ class ZopeSuiteFactory:
def __init__(self, *args, **kw): def __init__(self, *args, **kw):
self._args = args self._args = args
self._kw = kw self._kw = kw
self.run() self.setup_globs()
self.setup_test_class()
self.setup_optionflags()
def doctestsuite(self): def doctestsuite(self):
return doctest.DocTestSuite(*self._args, **self._kw) return doctest.DocTestSuite(*self._args, **self._kw)
...@@ -190,13 +193,9 @@ class ZopeSuiteFactory: ...@@ -190,13 +193,9 @@ class ZopeSuiteFactory:
def docfilesuite(self): def docfilesuite(self):
return doctest.DocFileSuite(*self._args, **self._kw) return doctest.DocFileSuite(*self._args, **self._kw)
def run(self):
self.setup_globs()
self.setup_test_class()
self.setup_optionflags()
def setup_globs(self): def setup_globs(self):
globs = self._kw.setdefault('globs', {}) globs = self._kw.setdefault('globs', {})
globs['folder_name'] = folder_name
globs['user_name'] = user_name globs['user_name'] = user_name
globs['user_password'] = user_password globs['user_password'] = user_password
globs['user_role'] = user_role globs['user_role'] = user_role
...@@ -213,9 +212,9 @@ class ZopeSuiteFactory: ...@@ -213,9 +212,9 @@ class ZopeSuiteFactory:
if not hasattr(test_class, 'runTest'): if not hasattr(test_class, 'runTest'):
setattr(test_class, 'runTest', None) setattr(test_class, 'runTest', None)
# Create a TestCase instance which will be used to # Create a TestCase instance which will be used to execute
# execute the setUp and tearDown methods, as well as # the setUp and tearDown methods, as well as be passed into
# be passed into the test globals as 'self'. # the test globals as 'self'.
test_instance = test_class() test_instance = test_class()
kwsetUp = self._kw.get('setUp') kwsetUp = self._kw.get('setUp')
...@@ -223,10 +222,10 @@ class ZopeSuiteFactory: ...@@ -223,10 +222,10 @@ class ZopeSuiteFactory:
test_instance.setUp() test_instance.setUp()
test.globs['test'] = test test.globs['test'] = test
test.globs['self'] = test_instance test.globs['self'] = test_instance
test.globs['app'] = test_instance.app if hasattr(test_instance, 'app'):
test.globs['app'] = test_instance.app
if hasattr(test_instance, 'folder'): if hasattr(test_instance, 'folder'):
test.globs['folder'] = test_instance.folder test.globs['folder'] = test_instance.folder
test.globs['folder_name'] = test_instance.folder.getId()
if hasattr(test_instance, 'portal'): if hasattr(test_instance, 'portal'):
test.globs['portal'] = test_instance.portal test.globs['portal'] = test_instance.portal
test.globs['portal_name'] = test_instance.portal.getId() test.globs['portal_name'] = test_instance.portal.getId()
...@@ -283,13 +282,7 @@ class FunctionalSuiteFactory(ZopeSuiteFactory): ...@@ -283,13 +282,7 @@ class FunctionalSuiteFactory(ZopeSuiteFactory):
| doctest.NORMALIZE_WHITESPACE) | doctest.NORMALIZE_WHITESPACE)
def ZopeDocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, **kw): def ZopeDocTestSuite(module=None, **kw):
if globs is not None:
kw['globs'] = globs
if extraglobs is not None:
kw['extraglobs'] = extraglobs
if test_finder is not None:
kw['test_finder'] = test_finder
module = doctest._normalize_module(module) module = doctest._normalize_module(module)
return ZopeSuiteFactory(module, **kw).doctestsuite() return ZopeSuiteFactory(module, **kw).doctestsuite()
...@@ -300,13 +293,7 @@ def ZopeDocFileSuite(*paths, **kw): ...@@ -300,13 +293,7 @@ def ZopeDocFileSuite(*paths, **kw):
return ZopeSuiteFactory(*paths, **kw).docfilesuite() return ZopeSuiteFactory(*paths, **kw).docfilesuite()
def FunctionalDocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, **kw): def FunctionalDocTestSuite(module=None, **kw):
if globs is not None:
kw['globs'] = globs
if extraglobs is not None:
kw['extraglobs'] = extraglobs
if test_finder is not None:
kw['test_finder'] = test_finder
module = doctest._normalize_module(module) module = doctest._normalize_module(module)
return FunctionalSuiteFactory(module, **kw).doctestsuite() return FunctionalSuiteFactory(module, **kw).doctestsuite()
......
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