Commit 1c42c045 authored by Stefan H. Holek's avatar Stefan H. Holek

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
parent 7a46ecdd
...@@ -104,6 +104,9 @@ named .testinfo, it will not be searched for tests. Really.) ...@@ -104,6 +104,9 @@ named .testinfo, it will not be searched for tests. Really.)
Keep running the selected tests in a loop. You may experience Keep running the selected tests in a loop. You may experience
memory leakage. memory leakage.
--nowarnings
Install a filter to suppress warnings emitted by code.
-t -t
Time the individual tests and print a list of the top 50, sorted from Time the individual tests and print a list of the top 50, sorted from
longest to shortest. longest to shortest.
...@@ -759,6 +762,7 @@ def process_args(argv=None): ...@@ -759,6 +762,7 @@ def process_args(argv=None):
global test_dir global test_dir
global config_file global config_file
global import_testing global import_testing
global no_warnings
if argv is None: if argv is None:
argv = sys.argv argv = sys.argv
...@@ -789,11 +793,12 @@ def process_args(argv=None): ...@@ -789,11 +793,12 @@ def process_args(argv=None):
test_dir = None test_dir = None
config_file = None config_file = None
import_testing = False import_testing = False
no_warnings = False
try: try:
opts, args = getopt.getopt(argv[1:], "a:bcC:dDfg:G:hLmprtTuv", opts, args = getopt.getopt(argv[1:], "a:bcC:dDfg:G:hLmprtTuv",
["all", "help", "libdir=", "times=", ["all", "help", "libdir=", "times=",
"keepbytecode", "dir=", "keepbytecode", "nowarnings", "dir=",
"config-file=", "import-testing", "config-file=", "import-testing",
"coverage", "profile", "hotshot"]) "coverage", "profile", "hotshot"])
except getopt.error, msg: except getopt.error, msg:
...@@ -872,6 +877,12 @@ def process_args(argv=None): ...@@ -872,6 +877,12 @@ def process_args(argv=None):
config_file = v config_file = v
elif k == '--import-testing': elif k == '--import-testing':
import_testing = True 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 is not None:
if gcthresh == 0: if gcthresh == 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment