[Checkins] SVN: Sandbox/ulif/grokcore.startup/src/grokcore/startup/tests/test_grokcorestartup.py Remove stuff we do not need at the moment.

Uli Fouquet uli at gnufix.de
Sun Feb 1 11:38:57 EST 2009


Log message for revision 95876:
  Remove stuff we do not need at the moment.

Changed:
  U   Sandbox/ulif/grokcore.startup/src/grokcore/startup/tests/test_grokcorestartup.py

-=-
Modified: Sandbox/ulif/grokcore.startup/src/grokcore/startup/tests/test_grokcorestartup.py
===================================================================
--- Sandbox/ulif/grokcore.startup/src/grokcore/startup/tests/test_grokcorestartup.py	2009-02-01 16:37:56 UTC (rev 95875)
+++ Sandbox/ulif/grokcore.startup/src/grokcore/startup/tests/test_grokcorestartup.py	2009-02-01 16:38:57 UTC (rev 95876)
@@ -1,15 +1,8 @@
+import os
 import re
-import unittest, traceback
-from pkg_resources import resource_listdir
-from zope.testing import doctest, cleanup, renormalizing
-import zope.component.eventtesting
+import unittest
+from zope.testing import doctest, renormalizing
 
-def setUpZope(test):
-    zope.component.eventtesting.setUp(test)
-
-def cleanUpZope(test):
-    cleanup.cleanUp()
-
 checker = renormalizing.RENormalizing([
     # str(Exception) has changed from Python 2.4 to 2.5 (due to
     # Exception now being a new-style class).  This changes the way
@@ -18,46 +11,19 @@
                 r'ConfigurationExecutionError: \1:'),
     ])
 
-def suiteFromPackage(name):
-    files = resource_listdir(__name__, name)
-    suite = unittest.TestSuite()
-    for filename in files:
-        if not filename.endswith('.py'):
-            continue
-        if filename.endswith('_fixture.py'):
-            continue
-        if filename == '__init__.py':
-            continue
+optionflags=(doctest.ELLIPSIS+
+            doctest.NORMALIZE_WHITESPACE)
 
-        dottedname = 'grokcore.component.tests.%s.%s' % (name, filename[:-3])
-        try:
-            test = doctest.DocTestSuite(dottedname,
-                                        setUp=setUpZope,
-                                        tearDown=cleanUpZope,
-                                        checker=checker,
-                                        optionflags=doctest.ELLIPSIS+
-                                        doctest.NORMALIZE_WHITESPACE)
-        except ImportError, e:  # or should this accept anything?
-            traceback.print_exc()
-            raise
-        suite.addTest(test)
-    return suite
+main_doctests = ['README.txt',]
 
 def test_suite():
     suite = unittest.TestSuite()
-    for name in ['adapter', 'directive', 'grokker', 'utility', 'view',
-                 'event']:
-        suite.addTest(suiteFromPackage(name))
 
-    api = doctest.DocFileSuite('api.txt')
-    suite.addTest(api)
-
-    # this test cannot follow the normal testing pattern, as the
-    # bug it tests for is only exposed in the context of a doctest
-    grok_component = doctest.DocFileSuite('grok_component.txt',
-                                          setUp=setUpZope,
-                                          tearDown=cleanUpZope)
-    suite.addTest(grok_component)
+    for testfile in main_doctests:
+        suite.addTest(
+            doctest.DocFileSuite(os.path.join('..', testfile),
+                                 optionflags=optionflags,
+                                 checker=checker))
     return suite
 
 if __name__ == '__main__':



More information about the Checkins mailing list