]> granicus.if.org Git - python/commitdiff
When run as a script, runs each test and sends results to stdout
authorBarry Warsaw <barry@python.org>
Tue, 10 Dec 1996 23:10:39 +0000 (23:10 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 10 Dec 1996 23:10:39 +0000 (23:10 +0000)
(i.e. this restores the old functionality).

Note that if a test couldn't be imported, it is just ignored (and no
warning is printed).

Lib/test/testall.py

index a132bfe7f8ef5790376caaa5b207d6360314c63a..b472c7fe8f120d56cee3e7e40a8bac85dedf2c03 100644 (file)
@@ -17,3 +17,20 @@ tests = ['test_grammar',
         'test_dbm',
         'test_new',
         ]
+
+if __name__ == '__main__':
+    # low-overhead testing, for cases where autotest.py harness
+    # doesn't even work!
+    import sys
+    from test_support import *
+
+    for t in tests:
+        print t
+       unload(t)
+       try:
+           __import__(t, globals(), locals())
+       except ImportError, msg:
+##         sys.stderr.write('%s.  Uninstalled optional module?\n' % msg)
+           pass
+
+    print 'Passed all tests.'