[Zope-dev] Ignoring Warnings

Chris Withers chris at simplistix.co.uk
Mon Dec 5 02:37:15 EST 2005


Great, so rather than fix the warnings, we add code to ignore them...

*sigh*

Chris

Stefan H. Holek wrote:
> Update of /cvs-repository/Zope
> In directory cvs.zope.org:/tmp/cvs-serv6383
> 
> Modified Files:
>       Tag: Zope-2_7-branch
> 	test.py 
> Log Message:
> 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
> 
> 
> === Zope/test.py 1.2.2.19 => 1.2.2.20 ===
> --- Zope/test.py:1.2.2.19	Tue Oct  4 14:22:40 2005
> +++ Zope/test.py	Sat Dec  3 09:31:33 2005
> @@ -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.
> @@ -740,6 +743,7 @@
>      global test_dir
>      global config_file
>      global import_testing
> +    global no_warnings
>  
>      if argv is None:
>          argv = sys.argv
> @@ -767,11 +771,12 @@
>      test_dir = None
>      config_file = None
>      import_testing = False
> +    now_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"])
>      except getopt.error, msg:
>          print msg
> @@ -843,6 +848,12 @@
>              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:
> 
> _______________________________________________
> Zope-Checkins maillist  -  Zope-Checkins at zope.org
> http://mail.zope.org/mailman/listinfo/zope-checkins
> 

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Zope-Dev mailing list