From 10887a3067c4755f0bcbcf4b049ba1df513ed4ce Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sun, 7 Sep 1997 06:12:11 +0000 Subject: [PATCH] Fix details in the test: - traceback should go to stdout! - don't import ni, import t1! - nicer support for command line options, only if run as __main__ --- Lib/test/test_pkg.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py index 9c8e44e9533..f0787148047 100644 --- a/Lib/test/test_pkg.py +++ b/Lib/test/test_pkg.py @@ -4,7 +4,6 @@ from os import mkdir, rmdir # Can't test if these fail del mkdir, rmdir from test_support import verbose -if sys.argv[1:2] == ['-q']: verbose = 0 # Helpers to create and destroy hierarchies. @@ -59,7 +58,7 @@ def runtest(hier, code): try: execfile(codefile, globals(), {}) except: - traceback.print_exc() + traceback.print_exc(file=sys.stdout) finally: sys.path[:] = savepath try: @@ -71,7 +70,7 @@ def runtest(hier, code): # Test descriptions tests = [ - ("t1", [("t1", None)], "import ni"), + ("t1", [("t1", None)], "import t1"), ("t2", [ ("t2", None), @@ -140,6 +139,7 @@ def runtest(hier, code): "print __name__, 'loading'; import string; print string.spam"), ], """ +import t5 from t5 import * print dir() import t5 @@ -181,6 +181,16 @@ def runtest(hier, code): # Run the tests +args = [] +if __name__ == '__main__': + args = sys.argv[1:] + if args and args[0] == '-q': + verbose = 0 + del args[0] + for name, hier, code in tests: + if args and name not in args: + print "skipping test", name + continue print "running test", name runtest(hier, code)