[Checkins]
SVN: grok/branches/philikon-eggification/src/grok/ftests/test_grok_functional.py
Remove a lot of unnecessarily complicated (because it was
copied from code
Philipp von Weitershausen
philikon at philikon.de
Tue Apr 17 18:07:40 EDT 2007
Log message for revision 74221:
Remove a lot of unnecessarily complicated (because it was copied from code
that was trying to be very general) and instead create some much simpler
prettier code :).
Again, inspired by my testing refactoring branch, which I might just let RIP
after having carried over the most important change to this branch: giving
grok it's own ftesting layer (which had become a necessity due to the lack
of a proper instance with the new egg-based recipes).
Changed:
U grok/branches/philikon-eggification/src/grok/ftests/test_grok_functional.py
-=-
Modified: grok/branches/philikon-eggification/src/grok/ftests/test_grok_functional.py
===================================================================
--- grok/branches/philikon-eggification/src/grok/ftests/test_grok_functional.py 2007-04-17 22:00:42 UTC (rev 74220)
+++ grok/branches/philikon-eggification/src/grok/ftests/test_grok_functional.py 2007-04-17 22:07:39 UTC (rev 74221)
@@ -10,42 +10,12 @@
ftesting_zcml = os.path.join(os.path.dirname(grok.__file__), 'ftesting.zcml')
GrokFunctionalLayer = ZCMLLayer(ftesting_zcml, 'grok', 'GrokFunctionalLayer')
-# XXX bastardized from zope.app.testing.functional.FunctionalDocFileSuite :-(
-def FunctionalDocTestSuite(*paths, **kw):
- globs = kw.setdefault('globs', {})
- globs['http'] = HTTPCaller()
- globs['getRootFolder'] = getRootFolder
- globs['sync'] = sync
+def setUp(test):
+ FunctionalTestSetup().setUp()
- #kw['package'] = doctest._normalize_module(kw.get('package'))
+def tearDown(test):
+ FunctionalTestSetup().tearDown()
- kwsetUp = kw.get('setUp')
- def setUp(test):
- FunctionalTestSetup().setUp()
-
- if kwsetUp is not None:
- kwsetUp(test)
- kw['setUp'] = setUp
-
- kwtearDown = kw.get('tearDown')
- def tearDown(test):
- if kwtearDown is not None:
- kwtearDown(test)
- FunctionalTestSetup().tearDown()
- kw['tearDown'] = tearDown
-
- if 'optionflags' not in kw:
- old = doctest.set_unittest_reportflags(0)
- doctest.set_unittest_reportflags(old)
- kw['optionflags'] = (old
- | doctest.ELLIPSIS
- | doctest.REPORT_NDIFF
- | doctest.NORMALIZE_WHITESPACE)
-
- suite = doctest.DocTestSuite(*paths, **kw)
- suite.layer = GrokFunctionalLayer
- return suite
-
def suiteFromPackage(name):
files = resource_listdir(__name__, name)
suite = unittest.TestSuite()
@@ -56,7 +26,16 @@
continue
dottedname = 'grok.ftests.%s.%s' % (name, filename[:-3])
- test = FunctionalDocTestSuite(dottedname)
+ test = doctest.DocTestSuite(
+ dottedname, setUp=setUp, tearDown=tearDown,
+ extraglobs=dict(http=HTTPCaller(),
+ getRootFolder=getRootFolder,
+ sync=sync),
+ optionflags=(doctest.ELLIPSIS+
+ doctest.NORMALIZE_WHITESPACE+
+ doctest.REPORT_NDIFF)
+ )
+ test.layer = GrokFunctionalLayer
suite.addTest(test)
return suite
More information about the Checkins
mailing list