[Zodb-checkins] CVS: ZODB3 - test.py:1.19.2.1.6.1
Jeremy Hylton
jeremy@zope.com
Tue, 17 Dec 2002 15:36:15 -0500
Update of /cvs-repository/ZODB3
In directory cvs.zope.org:/tmp/cvs-serv15341
Modified Files:
Tag: ZODB3-fast-restart-branch
test.py
Log Message:
Attempt to support -D
=== ZODB3/test.py 1.19.2.1 => 1.19.2.1.6.1 ===
--- ZODB3/test.py:1.19.2.1 Thu Oct 3 19:18:01 2002
+++ ZODB3/test.py Tue Dec 17 15:36:15 2002
@@ -29,6 +29,9 @@
Unfortunately, the debug harness doesn't print the name of the
test, so Use With Care.
+-D debugger
+ Works like -d, except that it loads pdb when an exception occurs.
+
-v verbose
With one -v, unittest prints a dot (".") for each test run. With
-vv, unittest prints the name of each test (for some definition of
@@ -82,6 +85,7 @@
import gc
import os
+import pdb
import re
import sys
import traceback
@@ -262,7 +266,13 @@
if test_filter is not None:
s = filter_testcases(s, test_filter)
suite.addTest(s)
- r = runner.run(suite)
+ try:
+ r = runner.run(suite)
+ except:
+ if debugger:
+ pdb.post_mortem(sys.exc_info()[2])
+ else:
+ raise
def remove_stale_bytecode(arg, dirname, names):
names = map(os.path.normcase, names)
@@ -296,6 +306,7 @@
global VERBOSE
global LOOP
global debug
+ global debugger
global build
global gcthresh
global gcdebug
@@ -305,6 +316,7 @@
VERBOSE = 0
LOOP = 0
debug = 0 # Don't collect test results; simply let tests crash
+ debugger = 0
build = 0
gcthresh = None
gcdebug = 0
@@ -322,6 +334,9 @@
VERBOSE += 1
elif k == '-d':
debug = 1
+ elif k == '-D':
+ debug = 1
+ debugger = 1
elif k == '-L':
LOOP = 1
elif k == '-b':