[Python-checkins] r59411 - python/trunk/Lib/doctest.py

alexandre.vassalotti python-checkins at python.org
Sat Dec 8 05:49:22 CET 2007


Author: alexandre.vassalotti
Date: Sat Dec  8 05:49:22 2007
New Revision: 59411

Modified:
   python/trunk/Lib/doctest.py
Log:
Fix issue #1530.
Return an error exit status if not all tests passes.


Modified: python/trunk/Lib/doctest.py
==============================================================================
--- python/trunk/Lib/doctest.py	(original)
+++ python/trunk/Lib/doctest.py	Sat Dec  8 05:49:22 2007
@@ -2657,12 +2657,15 @@
                 sys.path.insert(0, dirname)
                 m = __import__(filename[:-3])
                 del sys.path[0]
-                testmod(m)
+                failures, _ = testmod(m)
             else:
-                testfile(filename, module_relative=False)
+                failures, _ = testfile(filename, module_relative=False)
+            if failures:
+                return 1
     else:
         r = unittest.TextTestRunner()
         r.run(DocTestSuite())
+    return 0
 
 if __name__ == "__main__":
-    _test()
+    sys.exit(_test())


More information about the Python-checkins mailing list