[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/test.py Implemented a --nowarnings flag for test.py.

Stefan H. Holek stefan at epy.co.at
Sat Dec 3 09:32:19 EST 2005


Log message for revision 40519:
  Implemented a --nowarnings flag for test.py.
  Makes running CMF and Plone tests a lot less annoying.
  
  Usage: ./bin/zopectl test --keepbytecode --nowarnings --dir Products/CMFPlone
  

Changed:
  U   Zope/branches/Zope-2_8-branch/test.py

-=-
Modified: Zope/branches/Zope-2_8-branch/test.py
===================================================================
--- Zope/branches/Zope-2_8-branch/test.py	2005-12-03 13:38:38 UTC (rev 40518)
+++ Zope/branches/Zope-2_8-branch/test.py	2005-12-03 14:32:19 UTC (rev 40519)
@@ -104,6 +104,9 @@
     Keep running the selected tests in a loop.  You may experience
     memory leakage.
 
+--nowarnings
+    Install a filter to suppress warnings emitted by code.
+
 -t
     Time the individual tests and print a list of the top 50, sorted from
     longest to shortest.
@@ -759,6 +762,7 @@
     global test_dir
     global config_file
     global import_testing
+    global no_warnings
 
     if argv is None:
         argv = sys.argv
@@ -789,11 +793,12 @@
     test_dir = None
     config_file = None
     import_testing = False
+    no_warnings = False
 
     try:
         opts, args = getopt.getopt(argv[1:], "a:bcC:dDfg:G:hLmprtTuv",
                                    ["all", "help", "libdir=", "times=",
-                                    "keepbytecode", "dir=", 
+                                    "keepbytecode", "nowarnings", "dir=",
                                     "config-file=", "import-testing",
                                     "coverage", "profile", "hotshot"])
     except getopt.error, msg:
@@ -872,7 +877,13 @@
             config_file = v
         elif k == '--import-testing':
             import_testing = True
+        elif k == '--nowarnings':
+            no_warnings = True
 
+    if no_warnings:
+        import warnings
+        warnings.simplefilter('ignore', Warning, append=1)
+
     if gcthresh is not None:
         if gcthresh == 0:
             gc.disable()



More information about the Zope-Checkins mailing list