- From: Ville Skytta via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 16 Nov 2009 18:00:50 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/misc/testsuite In directory hutz:/tmp/cvs-serv29102 Modified Files: harness.py Log Message: Initial Python 3 compatibility tweaks. Index: harness.py =================================================================== RCS file: /sources/public/validator/misc/testsuite/harness.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- harness.py 28 Jul 2008 19:38:26 -0000 1.2 +++ harness.py 16 Nov 2009 18:00:48 -0000 1.3 @@ -70,8 +70,8 @@ for (opt, value) in opts: if opt == "h" or opt == "--help": raise Usage(msg) - except getopt.error, msg: - raise Usage(msg) + except getopt.GetoptError as err: + raise Usage(err) # option processing for option, value in opts: @@ -93,9 +93,9 @@ if len(args) == 0: raise Usage(help_message) - except Usage, err: - print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) - print >> sys.stderr, "\t for help use --help" + except Usage as err: + sys.stderr.write("%s: %s\n\t for help use --help\n" % \ + (sys.argv[0].split("/")[-1], str(err.msg))) return 2 @@ -145,7 +145,7 @@ def runTestSuite(testsuite, verbose): """Describe each test collection in the test suite and run them""" for collection in testsuite.collections: - print "*** Running Collection #%s: %s" % (collection.collection_id, collection.title) + print ("*** Running Collection #%s: %s" % (collection.collection_id, collection.title)) if collection.countTestCases() > 0: unittest.TextTestRunner(verbosity=verbose).run(collection) @@ -153,14 +153,14 @@ index = Documentation('list') test_suite = buildTestSuite() index.addTestSuite(test_suite) - print index.generate(template_path=os.path.join(basedir, "templates")).encode('utf-8') + print (index.generate(template_path=os.path.join(basedir, "templates")).encode('utf-8')) def generateIndex(): index = Documentation('index') test_suite = buildTestSuite() index.addTestSuite(test_suite) - print index.generate(template_path=os.path.join(basedir, "templates")).encode('utf-8') + print (index.generate(template_path=os.path.join(basedir, "templates")).encode('utf-8'))
Received on Monday, 16 November 2009 18:01:01 UTC