[Zope-Checkins] CVS: Zope3/lib/python/Zope/Testing - __init__.py:1.3.38.4

Shane Hathaway shane@cvs.zope.org
Thu, 14 Mar 2002 17:51:49 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Testing
In directory cvs.zope.org:/tmp/cvs-serv30753

Modified Files:
      Tag: Zope-3x-branch
	__init__.py 
Log Message:
Removed unused code and added an environment variable you can set for
testing.  Set NEW_EXCEPTION_FORMATTER to see traceback supplements 
and __traceback_info__ in test exceptions.


=== Zope3/lib/python/Zope/Testing/__init__.py 1.3.38.3 => 1.3.38.4 ===
 $Id$
 """
-
-#XXX we don't seem to need this. We should ax this soon. :)
-def setUpEnv():
-
-    import os
-
-    def pdir(path):
-        return os.path.split(path)[0]
-
-    # Set the INSTANCE_HOME to the Testing package directory
-    os.environ['INSTANCE_HOME'] = INSTANCE_HOME = pdir(__file__)
-
-    # Set the SOFTWARE_HOME to the directory containing the Testing package
-    os.environ['SOFTWARE_HOME'] = SOFTWARE_HOME = pdir(INSTANCE_HOME)
-
-    # Prevent useless initialization by pretending to be a ZEO client
-    os.environ['ZEO_CLIENT'] = '1'
+import os
 
 def allZopeTests():
-    #setUpEnv()
     from Builder import allZopeTests
     return allZopeTests()
+
+def patchTracebackModule():
+    """Use the ExceptionFormatter to show more info in tracebacks.
+    """
+    from Zope.Exceptions.ExceptionFormatter import format_exception
+    import traceback
+    traceback.format_exception = format_exception
+
+if os.environ.get('NEW_EXCEPTION_FORMATTER', 0):
+    patchTracebackModule()
+