public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/
Date: Fri,  5 Aug 2011 10:04:21 +0000 (UTC)	[thread overview]
Message-ID: <3c3a1d38d16fb75d72756ad3aedbad87c77ca02c.mgorny@gentoo> (raw)

commit:     3c3a1d38d16fb75d72756ad3aedbad87c77ca02c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  5 09:50:50 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug  5 10:05:39 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=3c3a1d38

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):
 
 	def tests_done(self):
 		print('-> Checking test results...')
-		self.failed = []
+		self.results = {}
 		for t in self.test_library:
 			try:
 				t.check_result(self.pm)
 			except Exception as e:
 				outc = 'F' if isinstance(e, AssertionError) else 'E'
-				self.failed.append(t)
+				self.results[t] = False
 				# XXX: store exception details somewhere?
 			else:
 				outc = '.'
+				self.results[t] = True
 			t.clean(self.pm)
 			print(outc, end='')
 		print('')
@@ -147,21 +148,21 @@ class PMSTestSuiteCLI(object):
 			self.all_done()
 
 	def all_done(self):
-		if not self.failed and not self.verbose:
-			print('%d tests completed successfully.' % len(self.test_library))
+		failed = 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 = 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 = 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'))
 
-		self.ret = 0 if not self.failed else 1
+		self.ret = 0 if not failed else 1
 		self.loop.quit()
 
 	def start_pm(self):



             reply	other threads:[~2011-08-05 10:04 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-05 10:04 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-20  8:01 [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/ Michał Górny
2012-01-04 16:33 Michał Górny
2012-01-03 15:52 Michał Górny
2012-01-03 15:52 Michał Górny
2012-01-03 15:52 Michał Górny
2012-01-03 15:52 Michał Górny
2011-08-21  8:19 Michał Górny
2011-08-20  6:23 Michał Górny
2011-08-13  7:38 Michał Górny
2011-08-08 22:15 Michał Górny
2011-08-05 21:36 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03  8:17 Michał Górny
2011-08-02 18:53 Michał Górny
2011-07-18  6:49 Michał Górny
2011-06-24 18:03 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/ Michał Górny
2011-06-22 19:53 Michał Górny
2011-06-21 17:58 Michał Górny
2011-06-21 17:54 Michał Górny
2011-06-21 17:54 Michał Górny
2011-06-16 19:49 Michał Górny
2011-06-15 16:14 Michał Górny
2011-06-13 19:16 Michał Górny
2011-06-11  6:32 Michał Górny
2011-06-09  5:48 Michał Górny
2011-06-07 16:48 Michał Górny
2011-06-07 16:48 Michał Górny
2011-06-07 15:20 Michał Górny
2011-06-06  5:56 Michał Górny
2011-06-03 16:25 Michał Górny
2011-05-31 21:06 Michał Górny
2011-05-31 19:18 Michał Górny
2011-05-31 17:19 Michał Górny
2011-05-31 17:19 Michał Górny
2011-05-29 17:46 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c3a1d38d16fb75d72756ad3aedbad87c77ca02c.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox