[Zope3-checkins] SVN: Zope3/branches/3.2/releases/Zope/test.py Updated to work with new test runner.

Jim Fulton jim at zope.com
Mon Dec 5 14:26:59 EST 2005


Log message for revision 40555:
  Updated to work with new test runner.
  

Changed:
  U   Zope3/branches/3.2/releases/Zope/test.py

-=-
Modified: Zope3/branches/3.2/releases/Zope/test.py
===================================================================
--- Zope3/branches/3.2/releases/Zope/test.py	2005-12-05 19:14:12 UTC (rev 40554)
+++ Zope3/branches/3.2/releases/Zope/test.py	2005-12-05 19:26:59 UTC (rev 40555)
@@ -20,17 +20,33 @@
 
 $Id$
 """
-import sys, os
+
+import logging, os, sys, warnings
 from distutils.util import get_platform
 
+
+here = os.path.abspath(os.path.dirname(sys.argv[0]))
+
+# Remove this directory from path:
+sys.path[:] = [p for p in sys.path if os.path.abspath(p) != here]
+
+# add build dir to path
 PLAT_SPEC = "%s-%s" % (get_platform(), sys.version[0:3])
+src = os.path.join(here, "build", "lib." + PLAT_SPEC)
+sys.path.insert(0, src) # put at beginning to avoid one in site_packages
 
-here = os.path.dirname(os.path.realpath(__file__))
-lib = os.path.join(here, "build", "lib." + PLAT_SPEC)
-sys.path.append(lib)
+from zope.testing import testrunner
 
-import zope.app.testing.test
+defaults = ['--tests-pattern', '^f?tests$', '--test-path', src, '--all', '-u']
 
-if __name__ == '__main__':
-    args = sys.argv[:1] + ["-ul", lib] + sys.argv[1:]
-    zope.app.testing.test.process_args(args)
+# Get rid of twisted.conch.ssh warning
+warnings.filterwarnings(
+    'ignore', 'PyCrypto', RuntimeWarning, 'twisted[.]conch[.]ssh')
+
+result = testrunner.run(defaults)
+
+# Avoid spurious error during exit. Some thing is trying to log
+# something after the files used by the logger have been closed.
+logging.disable(999999999)
+
+sys.exit(result)



More information about the Zope3-Checkins mailing list