From patchwork Tue Feb 9 11:37:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 8260271 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A821EBEEE5 for ; Tue, 9 Feb 2016 11:40:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0812020254 for ; Tue, 9 Feb 2016 11:40:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4276A200EC for ; Tue, 9 Feb 2016 11:40:41 +0000 (UTC) Received: from localhost ([::1]:54572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aT6eu-0003hC-Jv for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Feb 2016 06:40:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aT6cT-0007or-BV for qemu-devel@nongnu.org; Tue, 09 Feb 2016 06:38:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aT6cQ-0002xg-QS for qemu-devel@nongnu.org; Tue, 09 Feb 2016 06:38:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aT6cP-0002wz-TM for qemu-devel@nongnu.org; Tue, 09 Feb 2016 06:38:06 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 8A8D48F885 for ; Tue, 9 Feb 2016 11:38:05 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u19Bc3Vm022268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 9 Feb 2016 06:38:05 -0500 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6BFF43011F9F; Tue, 9 Feb 2016 12:38:03 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 9 Feb 2016 12:37:36 +0100 Message-Id: <1455017883-25867-5-git-send-email-armbru@redhat.com> In-Reply-To: <1455017883-25867-1-git-send-email-armbru@redhat.com> References: <1455017883-25867-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 04/31] tests: Use Python 2.6 "except E as ..." syntax X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PEP 8 calls for it, because it's forward compatible with Python 3. Supported since Python 2.6, which we require (commit fec2103). Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Acked-by: Stefan Hajnoczi Message-Id: <1450425164-24969-5-git-send-email-armbru@redhat.com> --- tests/image-fuzzer/runner.py | 12 ++++++------ tests/qemu-iotests/qed.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/image-fuzzer/runner.py b/tests/image-fuzzer/runner.py index be7e283..96a1c11 100755 --- a/tests/image-fuzzer/runner.py +++ b/tests/image-fuzzer/runner.py @@ -157,7 +157,7 @@ class TestEnv(object): try: os.makedirs(self.current_dir) - except OSError, e: + except OSError as e: print >>sys.stderr, \ "Error: The working directory '%s' cannot be used. Reason: %s"\ % (self.work_dir, e[1]) @@ -244,7 +244,7 @@ class TestEnv(object): temp_log = StringIO.StringIO() try: retcode = run_app(temp_log, current_cmd) - except OSError, e: + except OSError as e: multilog("%sError: Start of '%s' failed. Reason: %s\n\n" % (test_summary, os.path.basename(current_cmd[0]), e[1]), @@ -356,7 +356,7 @@ if __name__ == '__main__': opts, args = getopt.gnu_getopt(sys.argv[1:], 'c:hs:kvd:', ['command=', 'help', 'seed=', 'config=', 'keep_passed', 'verbose', 'duration=']) - except getopt.error, e: + except getopt.error as e: print >>sys.stderr, \ "Error: %s\n\nTry 'runner.py --help' for more information" % e sys.exit(1) @@ -374,7 +374,7 @@ if __name__ == '__main__': elif opt in ('-c', '--command'): try: command = json.loads(arg) - except (TypeError, ValueError, NameError), e: + except (TypeError, ValueError, NameError) as e: print >>sys.stderr, \ "Error: JSON array of test commands cannot be loaded.\n" \ "Reason: %s" % e @@ -390,7 +390,7 @@ if __name__ == '__main__': elif opt == '--config': try: config = json.loads(arg) - except (TypeError, ValueError, NameError), e: + except (TypeError, ValueError, NameError) as e: print >>sys.stderr, \ "Error: JSON array with the fuzzer configuration cannot" \ " be loaded\nReason: %s" % e @@ -414,7 +414,7 @@ if __name__ == '__main__': try: image_generator = __import__(generator_name) - except ImportError, e: + except ImportError as e: print >>sys.stderr, \ "Error: The image generator '%s' cannot be imported.\n" \ "Reason: %s" % (generator_name, e) diff --git a/tests/qemu-iotests/qed.py b/tests/qemu-iotests/qed.py index 52ff845..748068d 100755 --- a/tests/qemu-iotests/qed.py +++ b/tests/qemu-iotests/qed.py @@ -227,7 +227,7 @@ def main(): qed = QED(open(filename, 'r+b')) try: globals()[cmd](qed, *sys.argv[3:]) - except TypeError, e: + except TypeError as e: sys.stderr.write(globals()[cmd].__doc__ + '\n') sys.exit(1)