Index: main/waeup.kofa/trunk/src/waeup/kofa/testing.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/testing.py	(revision 12596)
+++ main/waeup.kofa/trunk/src/waeup/kofa/testing.py	(revision 12598)
@@ -44,4 +44,5 @@
                             allow_teardown=True)
 
+
 def get_all_loggers():
     """Get the keys of all logger defined globally.
@@ -53,4 +54,5 @@
         print "\nLOGGERS: ", ws_loggers
     return result
+
 
 def remove_new_loggers(old_loggers):
@@ -71,4 +73,5 @@
     return
 
+
 def remove_logger(name):
     """Remove logger with name `name`.
@@ -88,4 +91,5 @@
     zope.component.eventtesting.setUp(test)
 
+
 def cleanUpZope(test=None):
     """Clean up Zope-related registrations.
@@ -94,4 +98,5 @@
     """
     cleanUp()
+
 
 def maybe_grok():
@@ -178,5 +183,5 @@
 
     """
-    gsm =  getGlobalSiteManager()
+    gsm = getGlobalSiteManager()
     # If there are any event handlers registered already, we assume
     # that waeup.kofa was grokked already. There might be a batter
@@ -186,8 +191,9 @@
     # Register the zope.Public permission, normally done via ZCML setup.
     addCheckerPublic()
-    warnings.simplefilter('ignore') # disable (erraneous) warnings
+    warnings.simplefilter('ignore')   # disable (erraneous) warnings
     grok.testing.grok('waeup.kofa')
-    warnings.simplefilter('default') # reenable warnings
+    warnings.simplefilter('default')  # reenable warnings
     return True
+
 
 def setup_datacenter_conf():
@@ -204,4 +210,5 @@
     return
 
+
 def teardown_datacenter_conf():
     """Unregister a datacenter config utility for non-functional tests.
@@ -216,4 +223,5 @@
     gsm.unregisterUtility(conf, IDataCenterConfig)
     return
+
 
 class KofaUnitTestLayer(object):
@@ -300,5 +308,5 @@
     # http://reinout.vanrees.org/weblog/2009/07/16/invisible-test-diff.html:
     (re.compile(r'.*1034h'), ''),
-    (re.compile(r'httperror_seek_wrapper:'), 'HTTPError:' ),
+    (re.compile(r'httperror_seek_wrapper:'), 'HTTPError:'),
     (re.compile('[\d]{6}'), '<6-DIGITS>'),
     (re.compile('[\d]{10}'), '<10-DIGITS>'),
@@ -309,13 +317,20 @@
     ])
 
+
 old_loggers = []
+
+
 def setUp(test):
+    global old_loggers
     old_loggers = get_all_loggers()
     FunctionalTestSetup().setUp()
 
+
 def tearDown(test):
+    global old_loggers
     FunctionalTestSetup().tearDown()
     remove_new_loggers(old_loggers)
 
+
 def doctestsuite_for_module(dotted_path):
     """Create a doctest suite for the module at `dotted_path`.
@@ -323,22 +338,24 @@
     test = doctest.DocTestSuite(
         dotted_path,
-        setUp = setUp,
-        tearDown = tearDown,
-        checker = checker,
-        extraglobs = dict(
+        setUp=setUp,
+        tearDown=tearDown,
+        checker=checker,
+        extraglobs=dict(
             getRootFolder=getRootFolder,
             sync=sync,),
-        optionflags = (doctest.ELLIPSIS +
-                       doctest.NORMALIZE_WHITESPACE +
-                       doctest.REPORT_NDIFF),
+        optionflags=(doctest.ELLIPSIS +
+                     doctest.NORMALIZE_WHITESPACE +
+                     doctest.REPORT_NDIFF),
         )
     test.layer = FunctionalLayer
     return test
 
+
 optionflags = (
     doctest.REPORT_NDIFF + doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE)
 
+
 def clear_logger_collector():
-    from zope.component import queryUtility, getGlobalSiteManager
+    from zope.component import queryUtility
     from waeup.kofa.interfaces import ILoggerCollector
     collector = queryUtility(ILoggerCollector)
@@ -349,4 +366,5 @@
         del collector[key]
     return
+
 
 class FunctionalTestCase(FunctionalTestCase):
@@ -388,4 +406,5 @@
         self.fail(diff)
 
+
 class FunctionalTestSetup(FunctionalTestSetup):
     """A replacement for the zope.app.testing class.
@@ -403,4 +422,5 @@
         remove_new_loggers(self.old_loggers)
         return
+
 
 def get_doctest_suite(filename_list=[]):
@@ -431,11 +451,12 @@
             module_relative=False,
             setUp=setUp, tearDown=tearDown,
-            globs = dict(getRootFolder = getRootFolder),
-            optionflags = doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE,
-            checker = checker,
+            globs=dict(getRootFolder=getRootFolder),
+            optionflags=doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE,
+            checker=checker,
             )
         test.layer = FunctionalLayer
         suite.addTest(test)
     return suite
+
 
 class FakeJob(object):
@@ -448,4 +469,5 @@
         self.args = args
         self.kwargs = kw
+
 
 class FakeJobManager(object):
