[Python-checkins] distutils2: improved the test runner. Now handles the exit code and tries all supported

tarek.ziade python-checkins at python.org
Sun May 30 00:05:49 CEST 2010


tarek.ziade pushed db5be34ba98a to distutils2:

http://hg.python.org/distutils2/rev/db5be34ba98a
changeset:   171:db5be34ba98a
tag:         tip
user:        Tarek Ziade <tarek at ziade.org>
date:        Sun May 30 00:05:27 2010 +0200
summary:     improved the test runner. Now handles the exit code and tries all supported Python versions
files:       src/runtests.py, src/tests.sh

diff --git a/src/runtests.py b/src/runtests.py
--- a/src/runtests.py
+++ b/src/runtests.py
@@ -14,10 +14,15 @@
         verbose = sys.argv[-1] != '-q'
     else:
         verbose = 1
-
-    run_unittest([distutils2.tests.test_suite(), btest_suite()],
-                 verbose_=verbose)
-    reap_children()
+    try:
+        try:
+            run_unittest([distutils2.tests.test_suite(), btest_suite()],
+                    verbose_=verbose)
+            return 0
+        except TestFailed:
+            return 1
+    finally:
+        reap_children()
 
 if __name__ == "__main__":
     try:
@@ -26,4 +31,5 @@
         print('!!! You need to install unittest2')
         sys.exit(1)
 
-    test_main()
+    sys.exit(test_main())
+
diff --git a/src/tests.sh b/src/tests.sh
--- a/src/tests.sh
+++ b/src/tests.sh
@@ -1,12 +1,28 @@
 #!/bin/sh
-echo Testing with Python 2.4....
-python2.4 runtests.py -q
+echo -n "Running tests for Python 2.4..."
+python2.4 runtests.py -q > /dev/null 2> /dev/null
+if [ $? -ne 0 ];then
+    echo "Failed"
+    exit $1
+else
+    echo "Success"
+fi
 
-echo
-echo Testing with Python 2.5....
-python2.5 runtests.py -q
+echo -n "Running tests for Python 2.5..."
+python2.5 runtests.py -q > /dev/null 2> /dev/null
+if [ $? -ne 0 ];then
+    echo "Failed"
+    exit $1
+else
+    echo "Success"
+fi
 
-echo
-echo Testing with Python 2.6....
-python2.6 runtests.py -q
+echo -n "Running tests for Python 2.6..."
+python2.6 runtests.py -q > /dev/null 2> /dev/null
+if [ $? -ne 0 ];then
+    echo "Failed"
+    exit $1
+else
+    echo "Success"
+fi
 

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list