[Checkins] SVN: grokcore.view/trunk/src/grokcore/view/testing.py Save warnings for later examination.

Uli Fouquet uli at gnufix.de
Wed Feb 25 04:59:16 EST 2009


Log message for revision 97239:
  Save warnings for later examination.

Changed:
  U   grokcore.view/trunk/src/grokcore/view/testing.py

-=-
Modified: grokcore.view/trunk/src/grokcore/view/testing.py
===================================================================
--- grokcore.view/trunk/src/grokcore/view/testing.py	2009-02-25 09:26:06 UTC (rev 97238)
+++ grokcore.view/trunk/src/grokcore/view/testing.py	2009-02-25 09:59:15 UTC (rev 97239)
@@ -14,6 +14,7 @@
 """Grok test helpers
 """
 import sys
+import grokcore.view
 from zope.configuration.config import ConfigurationMachine
 from grokcore.component import zcml
 
@@ -26,6 +27,7 @@
     zcml.do_grok(module_name, config)
     config.execute_actions()
 
+lastwarning = '' # Here we collect warnings.
 def warn(message, category=None, stacklevel=1):
     """Intended to replace warnings.warn in tests.
 
@@ -48,10 +50,12 @@
     for i in range(lineno):
         line = file.readline()
 
-    print "%s:%s: %s: %s\n  %s" % (
+    warning ="%s:%s: %s: %s\n  %s" % (
         path,
         frame.f_lineno,
         category.__name__,
         message,
         line.strip(),
         )
+    grokcore.view.testing.lastwarning += warning
+    print warning



More information about the Checkins mailing list