From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id B863D1381F3 for ; Thu, 17 Oct 2013 07:32:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 62F39E0A7E; Thu, 17 Oct 2013 07:31:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F3ED0E0A7E for ; Thu, 17 Oct 2013 07:31:57 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1CDA033E66D for ; Thu, 17 Oct 2013 07:31:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id C442EE5460 for ; Thu, 17 Oct 2013 07:31:55 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1381986056.b02fab10e3ec124d1c2f0b66717451f55c3224a0.vapier@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/tests/__init__.py X-VCS-Directories: pym/portage/tests/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: b02fab10e3ec124d1c2f0b66717451f55c3224a0 X-VCS-Branch: master Date: Thu, 17 Oct 2013 07:31:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d5600671-057c-46fa-b4de-69f34357b887 X-Archives-Hash: 864407e96c55dc3cbb4465d9e69084d2 commit: b02fab10e3ec124d1c2f0b66717451f55c3224a0 Author: Mike Frysinger gentoo org> AuthorDate: Thu Oct 17 05:00:56 2013 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Thu Oct 17 05:00:56 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b02fab10 tests: support standard unittest.SkipTest exceptions --- pym/portage/tests/__init__.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/pym/portage/tests/__init__.py b/pym/portage/tests/__init__.py index 890851b..6c5c4df 100644 --- a/pym/portage/tests/__init__.py +++ b/pym/portage/tests/__init__.py @@ -13,6 +13,14 @@ try: except ImportError: from unittest import _TextTestResult +try: + # They added the skip framework to python-2.7. + # Drop this once we drop python-2.6 support. + unittest_skip_shims = False + import unittest.SkipTest as SkipTest # new in python-2.7 +except ImportError: + unittest_skip_shims = True + import portage from portage import os from portage import _encodings @@ -188,10 +196,14 @@ class TestCase(unittest.TestCase): except: result.addError(self, sys.exc_info()) return + ok = False try: testMethod() ok = True + except SkipTest as e: + result.addPortageSkip(self, "%s: SKIP: %s" % + (testMethod, str(e))) except self.failureException: if self.portage_skip is not None: if self.portage_skip is True: @@ -207,6 +219,7 @@ class TestCase(unittest.TestCase): raise except: result.addError(self, sys.exc_info()) + try: self.tearDown() except SystemExit: @@ -216,7 +229,8 @@ class TestCase(unittest.TestCase): except: result.addError(self, sys.exc_info()) ok = False - if ok: result.addSuccess(self) + if ok: + result.addSuccess(self) finally: result.stopTest(self) @@ -258,6 +272,16 @@ class TestCase(unittest.TestCase): if os.path.exists(path): raise self.failureException('path exists when it should not: %s' % path) +if unittest_skip_shims: + # Shim code for