Add option to run the unit tests under PDB, but enter
PDB before anything executes so you can set breakpoints etc.

Add option to disable nosetest from capturing stdout, handy for
adding print statements when debugging.

Note: the old --pdb arg behavior is now --pdb-errors, --pdb is now
used to enter pdb upon test execution. This minor change in command
line behavior much more accurately reflects the arg name and the
behavior.

--
John Dennis <jden...@redhat.com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
From 1d855539b538f298d471a7f8d6db9eb22690eb79 Mon Sep 17 00:00:00 2001
From: John Dennis <jden...@redhat.com>
Date: Tue, 22 Nov 2011 14:09:15 -0500
Subject: [PATCH 54/54] ticet 2135 - enhance make-test for debugging
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Add option to run the unit tests under PDB, but enter
PDB before anything executes so you can set breakpoints etc.

Add option to disable nosetest from capturing stdout, handy for
adding print statements when debugging.

Note: the old --pdb arg behavior is now --pdb-errors, --pdb is now
used to enter pdb upon test execution. This minor change in command
line behavior much more accurately reflects the arg name and the
behavior.
---
 make-test |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/make-test b/make-test
index b429a71..a034e45 100755
--- a/make-test
+++ b/make-test
@@ -27,6 +27,11 @@ parser.add_option('--stop',
 parser.add_option('--pdb',
 	action='store_true',
 	default=False,
+	help='Run the tests in pdb, starts at pdb prompt',
+)
+parser.add_option('--pdb-errors',
+	action='store_true',
+	default=False,
 	help='Drop into debugger on errors',
 )
 parser.add_option('--pdb-failures',
@@ -34,6 +39,11 @@ parser.add_option('--pdb-failures',
 	default=False,
 	help='Drop into debugger on failures',
 )
+parser.add_option('--nocapture',
+	action='store_true',
+	default=False,
+	help="Don't capture stdout (any stdout output will be printed immediately)",
+)
 (options, args) = parser.parse_args()
 
 cmd = [nose] + args + [
@@ -45,10 +55,15 @@ cmd = [nose] + args + [
 if options.stop:
     cmd.append('--stop')
 if options.pdb:
+    pdb_init = ['-m', 'pdb']
+else:
+    pdb_init = []
+if options.pdb_errors:
     cmd.append('--pdb')
 if options.pdb_failures:
     cmd.append('--pdb-failures')
-
+if options.nocapture:
+    cmd.append('--nocapture')
 
 # This must be set so ipalib.api gets initialized property for tests:
 os.environ['IPA_UNIT_TEST_MODE'] = 'cli_test'
@@ -60,7 +75,8 @@ for v in versions:
     pver = python + v
     if not path.isfile(pver):
         continue
-    if 0 != call([pver] + cmd):
+    print "cmd=%s" % ' '.join([pver] + pdb_init + cmd)
+    if 0 != call([pver] + pdb_init + cmd):
         fail.append(pver)
     ran.append(pver)
 
-- 
1.7.7.3

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to