From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QpHGX-0007Fs-OX for garchives@archives.gentoo.org; Fri, 05 Aug 2011 10:04:30 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5CC3F21C238; Fri, 5 Aug 2011 10:04:22 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3165921C246 for ; Fri, 5 Aug 2011 10:04:22 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A281F2AC01E for ; Fri, 5 Aug 2011 10:04:21 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 0AA0880043 for ; Fri, 5 Aug 2011 10:04:21 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <3c3a1d38d16fb75d72756ad3aedbad87c77ca02c.mgorny@gentoo> Subject: [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/ X-VCS-Repository: proj/pms-test-suite X-VCS-Files: pmstestsuite/cli.py X-VCS-Directories: pmstestsuite/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 3c3a1d38d16fb75d72756ad3aedbad87c77ca02c Date: Fri, 5 Aug 2011 10:04:21 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 5bc5c215fd1149beb313085d8e2c50d2 commit: 3c3a1d38d16fb75d72756ad3aedbad87c77ca02c Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Fri Aug 5 09:50:50 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Fri Aug 5 10:05:39 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3D3c3a1d38 Store test results in a dict instead of main+failed lists. --- pmstestsuite/cli.py | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pmstestsuite/cli.py b/pmstestsuite/cli.py index f21c7a9..97dd8db 100644 --- a/pmstestsuite/cli.py +++ b/pmstestsuite/cli.py @@ -126,16 +126,17 @@ class PMSTestSuiteCLI(object): =20 def tests_done(self): print('-> Checking test results...') - self.failed =3D [] + self.results =3D {} for t in self.test_library: try: t.check_result(self.pm) except Exception as e: outc =3D 'F' if isinstance(e, AssertionError) else 'E' - self.failed.append(t) + self.results[t] =3D False # XXX: store exception details somewhere? else: outc =3D '.' + self.results[t] =3D True t.clean(self.pm) print(outc, end=3D'') print('') @@ -147,21 +148,21 @@ class PMSTestSuiteCLI(object): self.all_done() =20 def all_done(self): - if not self.failed and not self.verbose: - print('%d tests completed successfully.' % len(self.test_library)) + failed =3D filter(lambda tr: not tr[1], self.results.items()) + if not failed and not self.verbose: + print('%d tests completed successfully.' % len(self.results)) else: print('%d of %d tests completed successfully, %d failed:' - % (len(self.test_library) - len(self.failed), - len(self.test_library), len(self.failed))) - tl =3D self.failed if not self.verbose else self.test_library - for t in tl: - print('- %s [%s]' % (t, - 'OK' if t not in self.failed else 'FAILED')) + % (len(self.results) - len(failed), + len(self.results), len(failed))) + tl =3D failed if not self.verbose else self.results.items() + for t, r in tl: + print('- %s [%s]' % (t, 'OK' if r else 'FAILED')) for a in t.assertions: print('-> %s: %s [%s]' % (a.name, str(a), 'OK' if a else 'FAILED')) =20 - self.ret =3D 0 if not self.failed else 1 + self.ret =3D 0 if not failed else 1 self.loop.quit() =20 def start_pm(self):