Code

Add config-option "nosy" to messages_to_author setting in [nosy] section
[roundup.git] / run_tests.py
index bdd9b7a70a744a0231bac4d88014b74654171a1d..5855e8a0c5a7324f24a4fb066630ac134f091e68 100644 (file)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2.2
+#! /usr/bin/env python
 ##############################################################################
 #
 # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
@@ -176,17 +176,19 @@ class ImmediateTestResult(unittest._TextTestResult):
     __super_startTest = unittest._TextTestResult.startTest
     __super_printErrors = unittest._TextTestResult.printErrors
 
-    def __init__(self, stream, descriptions, verbosity, debug=False,
-                 count=None, progress=False):
+    def __init__(self, stream, descriptions, verbosity, debug=0,
+                 count=None, progress=0):
         self.__super_init(stream, descriptions, verbosity)
         self._debug = debug
         self._progress = progress
-        self._progressWithNames = False
+        self._progressWithNames = 0
         self._count = count
         self._testtimes = {}
+        # docstrings for tests don't override test-descriptions:
+        self.descriptions = False
         if progress and verbosity == 1:
-            self.dots = False
-            self._progressWithNames = True
+            self.dots = 0
+            self._progressWithNames = 1
             self._lastWidth = 0
             self._maxWidth = 80
             try:
@@ -344,9 +346,9 @@ class PathInit:
         if self.inplace is None:
             # Need to figure it out
             if os.path.isdir(os.path.join("build", "lib.%s" % PLAT_SPEC)):
-                self.inplace = False
+                self.inplace = 0
             else:
-                self.inplace = True
+                self.inplace = 1
         # Calculate which directories we're going to add to sys.path, and cd
         # to the appropriate working directory
         org_cwd = os.getcwd()
@@ -381,7 +383,7 @@ class PathInit:
 
 def match(rx, s):
     if not rx:
-        return True
+        return 1
     if rx[0] == "!":
         return re.search(rx[1:], s) is None
     else:
@@ -446,7 +448,8 @@ def walk_with_symlinks(top, func, arg):
     cycles in your Zope sandbox, so don't do that.
     """
     try:
-        names = os.listdir(top)
+        # Prevent 'hidden' files (those starting with '.') from being considered.
+        names = [f for f in os.listdir(top) if not f.startswith('.')]
     except os.error:
         return
     func(arg, top, names)
@@ -538,7 +541,8 @@ def gui_runner(files, test_filter):
 
     suites = ", ".join(suites)
     minimal = (GUI == "minimal")
-    unittestgui.main(suites, minimal)
+    # unittestgui apparently doesn't take the minimal flag anymore
+    unittestgui.main(suites)
 
 class TrackRefs:
     """Object to track reference counts across test runs."""
@@ -576,7 +580,7 @@ class TrackRefs:
 
 def runner(files, test_filter, debug):
     runner = ImmediateTestRunner(verbosity=VERBOSE, debug=debug,
-                                 progress=progress)
+        progress=progress)
     suite = unittest.TestSuite()
     for file in files:
         s = get_suite(file)
@@ -649,7 +653,7 @@ def main(module_filter, test_filter, libdir):
         if REFCOUNT:
             rc = sys.gettotalrefcount()
             track = TrackRefs()
-        while True:
+        while 1:
             runner(files, test_filter, debug)
             gc.collect()
             if gc.garbage:
@@ -691,25 +695,25 @@ def process_args(argv=None):
 
     module_filter = None
     test_filter = None
-    VERBOSE = 1
-    LOOP = False
-    GUI = False
-    TRACE = False
-    REFCOUNT = False
-    debug = False # Don't collect test results; simply let tests crash
-    debugger = False
-    build = False
-    build_inplace = False
+    VERBOSE = 2
+    LOOP = 0
+    GUI = 0
+    TRACE = 0
+    REFCOUNT = 0
+    debug = 0 # Don't collect test results; simply let tests crash
+    debugger = 0
+    build = 0
+    build_inplace = 0
     gcthresh = None
     gcdebug = 0
     gcflags = []
     level = 1
     libdir = '.'
-    progress = False
+    progress = 0
     timesfn = None
     timetests = 0
     keepStaleBytecode = 0
-    functional = False
+    functional = 0
     test_dir = None
 
     try:
@@ -728,21 +732,21 @@ def process_args(argv=None):
             level = 0
             os.environ["COMPLAIN_IF_TESTS_MISSED"]='1'
         elif k in ("-b", "--build"):
-            build = True
+            build = 1
         elif k == "-B":
-             build = build_inplace = True
+             build = build_inplace = 1
         elif k == "-c":
             # make sure you have a recent version of pychecker
             if not os.environ.get("PYCHECKER"):
                 os.environ["PYCHECKER"] = "-q"
             import pychecker.checker
         elif k == "-d":
-            debug = True
+            debug = 1
         elif k == "-D":
-            debug = True
-            debugger = True
+            debug = 1
+            debugger = 1
         elif k == "-f":
-            functional = True
+            functional = 1
         elif k in ("-h", "--help"):
             print __doc__
             sys.exit(0)
@@ -762,14 +766,14 @@ def process_args(argv=None):
         elif k == "-m":
             GUI = "minimal"
         elif k == "-p":
-            progress = True
+            progress = 1
         elif k == "-r":
             if hasattr(sys, "gettotalrefcount"):
-                REFCOUNT = True
+                REFCOUNT = 1
             else:
                 print "-r ignored, because it needs a debug build of Python"
         elif k == "-T":
-            TRACE = True
+            TRACE = 1
         elif k == "-t":
             if not timetests:
                 timetests = 50
@@ -786,14 +790,6 @@ def process_args(argv=None):
         elif k == '--dir':
             test_dir = v
 
-    if sys.version_info < ( 2,2,3 ):
-       print """\
-       ERROR: Your python version is not supported by Zope3.
-       Zope3 needs either Python2.3 or Python2.2.3 or greater.
-       In particular, Zope3 on Python2.2.2 is a recipe for
-       pain. You are running:""" + sys.version
-       sys.exit(1)
-
     if gcthresh is not None:
         if gcthresh == 0:
             gc.disable()
@@ -864,7 +860,7 @@ def process_args(argv=None):
             ignoremods = ["os", "posixpath", "stat"]
             tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
                                  ignoremods=ignoremods,
-                                 trace=False, count=True)
+                                 trace=0, count=1)
 
             tracer.runctx("main(module_filter, test_filter, libdir)",
                           globals=globals(), locals=vars())
@@ -875,7 +871,7 @@ def process_args(argv=None):
             cPickle.dump(r, f)
             f.close()
             print path
-            r.write_results(show_missing=True, summary=True, coverdir=coverdir)
+            r.write_results(show_missing=1, summary=1, coverdir=coverdir)
         else:
             bad = main(module_filter, test_filter, libdir)
             if bad: